I have a problem with how Facebook plugin shows my WordPress-based posts on my timeline. What basically happens is that the post image isn’t shown.
Now, the post image I want to show is a custom field of a custom post type, and this is probably what’s causing the problem to the Facebook plugin.
On the single-post page I added manually the og:
tags, and they’re working properly (I see the image if I share the link on Facebook, and the Facebook object debugger shows it too, saying there are no problems).
Do have I to do something to add manually the requested og:
tags in post_publish hook?
A sample page is this:
http://www.zannoni-store.it/prodotti/canestro-sonoro
And what I added in order to let the image be shown on share is this:
..
$img = get_post(get_post_meta($post->ID, 'immagine', true));
echo '<meta property="og:image" content="'.$img->guid.'" />';
..
reading the code of the Facebook Official Plugin I’ve seen that in
It’s being applied the custom filter ‘fb_meta_tags’:
So in my plugin I’ve added a filter for ‘fb_meta_tags’ that adds/replace the image set from the Facebook plugin in this way:
Please note that the “2” (4th param passed to add_filter) is mandatory, because the Facebook filter it’s providing the $meta_tags array and the $post object.
I think this solution ca be easily extended to any post-type / custom-field etc. situation; and that’s the correct way to achieve this goal.
Unfortunately this not solve the publish problem.