Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Facebook Share Thumbnail seclection issue WordPress


Hi Guys

Check out this site

When you click teh Facebook share button the window comes up ok but the image from the actual post is not available for selection.


Can it be fixed?

have tried a couple of plug ins but no joy


Answers (5)


Dbranes answers:

Hi, you don't have any Facebook meta data (opengraph protocol) defined for this site.

You should install this plugin

[[LINK href=""]][[/LINK]]

to setup the relevant facebook meta data.

When you have installed it, you can check the Facebook Object debugger to see how the page metadata is fetched

[[LINK href=""]]

The debugger currently gives an error:

Object at URL '' of type 'website' is invalid because the given value '' for property 'og:image:url' could not be parsed as type '

it should be fixed when you have installed the plugin.

ps: you should also remove the two plugins (facebook-like-thumbnail and facebook-image-fix), since they are not working on you site:

<!-- Start FaceBook Image Fix <> -->
<link rel="image_src" href="" />
<!-- End FaceBook Image Fix Plugin -->

<!-- Facebook Like Thumbnail -->
<meta property="og:image" content="" />
<!-- End Facebook Like Thumbnail -->


Arnav Joy answers:

where is facebook share button?

Steve Watson comments:

Wrong link sorry -

Arnav Joy comments:

when i click on facebook share button then at new window image thumbnail is there , so can you let me know is the problem


phppoet answers:

Are you using wordpress WP-PrettyPhoto like plugin . if yes then deactivate it and try again .

phppoet comments:

your facebook sharing button is working perfectly and is showing your posts default featured image . if you want your desired image in facebook sharing then use featured image feature while creating new post .

phppoet comments:

Facebook has a set of open-graph meta tags that it looks at to decide which image to show.
The key one for the Facebook image is: <meta property="og:image" content=""/> and it should be present inside the <head></head> tag at the top of your page.

If these tags are not present, it will look for their older method of specifying an image: <link rel="image_src" href="/myimage.jpg"/>. If neither are present, Facebook will look at the content of your page and choose images from your page that meet its share image criteria: Image must be at least 50px by 50px, have a maximum aspect ratio of 3:1, and in PNG, JPEG or GIF format.

Either you are using a theme which automatically put some meta image tags into head or you are using a plugin which is generating few other images in the post . therefore facebook share catches the first image which matches their algorithm.


Kiet Luong answers:

can you try this code within your loop:
<link rel="image_src" href="_link_to_your_right_thumbnail_" />

also please check out this [[LINK href=""]]post[[/LINK]] and debug your issue.

Hope this help !


Martin Pham answers:

Please try this

function _get_image_id( $index = 0 ) {
global $post;
$image_ids = array_keys(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC',
if ( isset( $image_ids[$index] ) )
return $image_ids[$index];
return false;

function get_att_images($args = array()) {
global $post;
$defaults = array(
'format' => 'url',
'size' => 'full',
'num' => 0,
'attr' => '',
$args = wp_parse_args( $args, $defaults );
if ( has_post_thumbnail() && ( 0 === $args['num'] ) ) {
$id = get_post_thumbnail_id();
$html = wp_get_attachment_image( $id, $args['size'], false, $args['attr'] );
list( $url ) = wp_get_attachment_image_src( $id, $args['size'], false, $args['attr'] );
} else {
$id = _get_image_id( $args['num'] );
$html = wp_get_attachment_image( $id, $args['size'], false, $args['attr'] );
list( $url ) = wp_get_attachment_image_src( $id, $args['size'], false, $args['attr'] );
$src = str_replace( home_url(), '', $url );

if ( 'html' === strtolower( $args['format'] ) )
$output = $html;
elseif ( 'url' === strtolower( $args['format'] ) )
$output = $url;
$output = $src;

if ( empty( $url ) ) $output = false;
return $output;

function insert_fb_in_head() {
global $post;
if ( !is_singular()) //if it is not a post or a page

echo '<meta property="og:url" content="' . get_permalink() . '"/>';
echo '<meta property="og:locale" content="en_US" />';
echo '<meta property="og:title" content="' . get_the_title() . '"/>';
echo '<meta property="og:type" content="article"/>';
// get img src from custom field
$post_thumb = get_post_meta($post->ID, 'image', true);
if(empty($post_thumb)) {
$post_thumb = get_att_images();
echo '<meta property="og:image" content="' .$post_thumb. '" />';
echo "\n";
add_action( 'wp_head', 'insert_fb_in_head', 5 );

Insert into functions.php or gazette/includes/theme-functions.php
[[LINK href=""]]phim[[/LINK]]