Support » Plugins » Facebook OpenGraph for my website not returning the correct image.

  • Hi WordPress Experts!

    I would like to seek your help about my problem with the FB OpenGraph. My situation is this, I successfully implemented the FB opengraph on every blog post using a funtion (which you can see below)

    //Adding the Open Graph in the Language Attributes
    function add_opengraph_doctype( $output ) {
    		return $output . ' xmlns:og="" xmlns:fb=""';
    add_filter('language_attributes', 'add_opengraph_doctype');
    //Lets add Open Graph Meta Info
    function insert_fb_in_head() {
    	global $post;
    	if ( !is_singular()) //if it is not a post or a page
            echo '<meta property="fb:admins" content="100000132424794"/>';
            echo '<meta property="og:title" content="' . get_the_title() . '"/>';
            echo '<meta property="og:type" content="article"/>';
            echo '<meta property="og:url" content="' . get_permalink() . '"/>';
            echo '<meta property="og:site_name" content="BenDaggers.Com"/>';
    	if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
    		$default_image=""; //replace this with a default image on your server or an image in your media library
    		echo '<meta property="og:image" content="' . $default_image . '"/>';
    		$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
    		echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
    	echo "\n";
    add_action( 'wp_head', 'insert_fb_in_head', 5 );

    When someone Likes or shares my blog post, it returns the correct values in facebook (image, title, permalink and description).

    However, if some shares my website, its not returning correct image. I tried the Linter but all i get is "Error parsing input URL, no data was scraped." The worst part in using linter is it’s not displaying what it suppose to display like og:title, og:type, og:url and or:site_name. Just a plain error.

    To make my question clear, you can try to copy paste my website link in your facebook status box and you’ll see that it’s not displaying any thumbnail.

    What seems to be the problem? Need your help.

    Thank you very much!

  • The topic ‘Facebook OpenGraph for my website not returning the correct image.’ is closed to new replies.