• Publicize sometimes posts wrong image to facebook but not everytime.
    I suspect that this code at my theme header.php has to do with it:

    <?php
    		if (! is_404() ) {
    			$thumbnail_id = get_post_thumbnail_id();
    			if( !empty($thumbnail_id) ){
    				$thumbnail = wp_get_attachment_image_src( $thumbnail_id , '440x280' );?>
    				<meta property="og:image" content="<?php echo esc_attr($thumbnail[0])?>" />
    			<?php }
    		}
    wp_head(); ?>
    <!-- end head -->

    So i was wondering if you can help whats wrong with this code and fix so publicize uses the right image.

    also maybe this code at the theme functions.php can help to understand much more:

    }
    add_action('init', 'jellywp_register_menu');
    add_filter( 'widget_text', 'do_shortcode' );
    add_theme_support('post-thumbnails');
    add_theme_support( 'automatic-feed-links' );
    
    // Post thumbnail support
    if (function_exists('add_theme_support')) {
    	add_theme_support('post-thumbnails');
    	add_image_size('slider-large', 1140, 540, true);
    	add_image_size('slider-normal', 670, 460, true);
    	add_image_size('slider-small', 240, 140, true);
    	add_image_size('feature-grid', 250, 242, true);
    	add_image_size('small-grid', 171, 108, true);
    	add_image_size('medium-feature', 400, 260, true);
    	add_image_size('small-feature', 100, 75, true);
    	add_image_size('slider-feature', 735, 400, true);
    }

    Thank you.

    ps. I forget to write that at https://developers.facebook.com/tools/debug/ the posts which publicize gets wrong image are always with the right image. And the only error that show at debug tool is:
    fb:app_id hasn't been included in the meta tags. Specify the app ID so that stories shared to Facebook will be properly attributed to the app. Alternatively, app_id can be set in url when open the share dialog. Otherwise, the default app id( 966242223397117 ) will be assigned.

    https://wordpress.org/plugins/jetpack/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter luanluan

    (@luanluan)

    I removed this line at the header.php:
    <meta property="og:image" content="<?php echo esc_attr($thumbnail[0])?>" />

    and i also installed this plugin to deactivate Jetpack’s Open Graph Meta tags:
    http://i.wpne.ws/M7Le

    but still the same problem, i have used other plugins like SNAP, Social, Facebook Publish and all of them show the right image, so it is just Publicize that somehow doesn’t always use the right image.

    In my site i use megamenu and i think that always when the publicize shows the wrong image shows an image that is at the one of the posts at megamenu.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    The code you published above adds an Open Graph Image tag to your site if you’ve defined a Featured Image in the post. You probably don’t need that code at all, since plugins like Jetpack add all the necessary meta tags to your site for you. That includes the image tag whenever you add an image to your post (with a preference for the featured image if you’ve added one), but also several other tags needed by Facebook.

    I would consequently recommend that you remove that code, and let your other plugins (like Jetpack) take care of that for you.

    Once you’ve removed the code, check your site’s source code, and see what plugin actually outputs meta tags in the head. If you use Jetpack, and if you don’t use any other Open Graph plugin, you should see the following, right before the tags:
    <!-- Jetpack Open Graph Tags -->

    If you use another Open Graph plugin, Jetpack’s tags won’t be added to your site, and we’ll let the other plugin take care of the tags for you.

    Could you then enter one of your posts’ URLs in Facebook Debugger again, and click on the “Fetch New Scrape Information” button to force Facebook to visit your site again and grab the Open Graph tags there?
    Do you them get any errors? (the app:id error you mentioned above can be ignored).

    If you don’t get any errors, could you try to publish a new post, and let me know if the Publicized post still fails to grab the right image? If it does, could you immediately visit Facebook Debugger and check the errors reported by Facebook?

    Let me know what you find.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Publicize sometimes posts wrong image to Facebook’ is closed to new replies.