When I share a product on Facebook, a random image appears rather than the corresponding image.

How do I get the correct image to appear when I share a product to facebook? I had to disable the Ultimate Facebook plugin because it caused my product pages on the wordpress site to disappear, so now when I manually share to Facebook I end up with a random image rather than one of the product I am linking.

  • Jeremy

    I have opened separate queries for MarketPress, WP_Smush, and Ultimate Facebook now.

    I began to experiment with different OG plugins, though I am getting mixed results, presumably because of the positioning of another OG tag with a faulty URL. In other words, sometimes the plugin places it above, only to be overwritten with the broken tag, and other times it lands below and overrides the broken metatag.

    The best solution would identify what is producing the metatag as well as what is causing it to make a broken URL (containing whitespace).

    Thanks for your continued efforts,

  • Adam Czajczyk

    Hello Jeremy,

    I hope you're well today and thanks for your response!

    Facebook is using og:image Open Graph meta tag to identify the correct featured image for the status. As my colleague @Predrag Dubajic suggested it would be good to implement a plugin that's handling that tag.

    However, it's possible (and I think your efforts just confirm that) that some plugins produce that tag also and furthermore it's also possible that the theme itself is trying to add it.

    I think the way to proceed here would be to do following (as in class plugin conflict test):

    1. Disable all plugins, clear cache (in case you're using caching plugin such as e.g. W3 Total Cache), clear browser's cache, refresh the page and preview page source;

    If there's an "og:image" tag already then the theme is generating it and it will be necessary to tweak theme. If not, then

    2. Enable single plugin (from the bottom or top of the plugin list, that's most convenient way), clear site's cache, clear browser's cache, refresh the page and preview page source;

    3. Repeat step #2 "in a loop" until you find all the plugins that generate "og:image" tag, which image they use and where they put it.

    This entire procedure should be performed using the very same page of your site of course. This should help you identify wrong and right usage of og:image tag and get to know which plugin is picking up correct image.

    Let me know please what was the result!

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.