WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

No idea how to ask this... so I'll give it my best.

I have a Wordpress site, self hosted. When I post a link to a post on Facebook, Facebook tries to detect a preview graphic to show along with the post (see screenshot)


For whatever reason, Facebook always picks up the Stumbleupon share button for the graphic. It's not the first graphic on the page, and it's not the last either, so I'm not sure why.

But more importantly, my question is... when I am not using a Featured Image for the post (sometimes I do, sometimes I do not), how can I make sure that previews such as this pick a different image? The site uses a favicon, but that doesn't seem to work in this instance.

Is there an image, or something I can set in code, that would allow me to specify what image gets picked up when a site tried to create a preview like this?

share|improve this question
up vote 2 down vote accepted

The accepted answer over on StackOverflow looks to be the best way to do this. You'll want to get into your header.php file to make these changes.


Now if the image should change from post to post, I would probably write something using JQUERY to change the value of the meta tag on the post.

share|improve this answer
Interesting, thanks... I'll give that a try. – Charlie74 Feb 14 '14 at 19:28
This also seems to be the way to go for WordPress websites, yes. But you wouldn't set/alter the image via jQuery—you would do this in PHP. For instance, use the featured image of the first post that has one (with a fallback solution), or so. And don't forget to wp_reset_postdata after you cycled through your posts. – tfrommen Feb 14 '14 at 19:29

There are meta elements you can add into your <head> to tell Facebook what to use for the image and description. You can manually add them into your theme. But there are already WordPress plugins that will add this. The benifit is they handle the logic for each post too.

  1. Facebook's WordPress plugin (it does much more than just the open graph tags): https://developers.facebook.com/docs/wordpress/
  2. WP Open Graph plugin: http://wordpress.org/plugins/wp-open-graph/
  3. WordPress.com's Jetpack plugin adds them (among many other things it does): http://jetpack.me/tag/open-graph/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.