vamsi godavarthi
asked 9 years ago

This is one of many url I am getting the error.
More Than One OG URL Specified

 Object at URL 'http://mindsvilla.com/2014/04/national-seeds-corporation-limited-recruitment-2014-marketing-executives/' of type 'article' is invalid because it specifies multiple 'og:url' values: http://mindsvilla.com/2014/04/national-seeds-corporation-limited-recruitment-2014-marketing-executives/, http://mindsvilla.com/2014/04/national-seeds-corporation-limited-recruitment-2014-marketing-executives/.

 
This is an error with code.Please do the needful.
 
 

1 Answers
DominicStaff
answered 9 years ago

Hello Vamsi !
To resolve this issue please follow mu instruction here:
1. Open functions.php file in /wp-content/themes/dw-focus/functions.php
2. Replace the following code – form line 474 to line 496

    if( ! function_exists('dw_focus_post_views') ) { 
/**
* Views count for a single post
*/
function dw_focus_post_views() {
if( is_single() ){
global $post;
$view = get_post_meta($post->ID, '_views', true);
$view = $view ? $view+1 : 1;
update_post_meta($post->ID, '_views', $view);
echo '<meta property="og:title" content="'.get_the_title().'" />';
echo '<meta property="og:url" content="'.get_permalink().'" />';
if( has_post_thumbnail() ) {
$thumb_id = get_post_thumbnail_id();
$thumb = wp_get_attachment_thumb_url( $thumb_id );
echo '<meta property="og:image" content="'.$thumb.'" />';
}
echo '<meta property="og:description" content="'. esc_html( get_the_excerpt() ) .'"/>';
}
}
add_action('wp_head', 'dw_focus_post_views');
}

with

    // if( ! function_exists('dw_focus_post_views') ) { 
// /**
// * Views count for a single post
// */
// function dw_focus_post_views() {
// if( is_single() ){
// global $post;
// $view = get_post_meta($post->ID, '_views', true);
// $view = $view ? $view+1 : 1;
// update_post_meta($post->ID, '_views', $view);
// echo '<meta property="og:title" content="'.get_the_title().'" />';
// echo '<meta property="og:url" content="'.get_permalink().'" />';
// if( has_post_thumbnail() ) {
// $thumb_id = get_post_thumbnail_id();
// $thumb = wp_get_attachment_thumb_url( $thumb_id );
// echo '<meta property="og:image" content="'.$thumb.'" />';
// }
// echo '<meta property="og:description" content="'. esc_html( get_the_excerpt() ) .'"/>';
// }
// }
// add_action('wp_head', 'dw_focus_post_views');
// }

Hope this helps !

Powered by DW Question & Answer Pro