Wrong image shared on Facebook via wordpress! Repair

Wrong image shared on Facebook via wordpress! Repair

If you are running a WordPress website, you must have been interested in getting social media traffic from Facebook. Now if you are trying to share your article on Facebook, have you noticed that you are sharing the wrong image, taken from the sidebar or from the header? This is critical as it disturbs the original subject matter of your shared post and thus reduces the number of clicks on your shared Facebook post. Now here is a guide to solve this problem.




Wrong image shared on Facebook via wordpress! Repair

How to fix it

First of all, enable the open graphic protocol on your wordpress blog. To do this, you can use one of the two methods listed below:

Method 1 -

Just go and install Facebook Plugin

. This is the plugin straight from the Facebook house and it will take care of solving your OG chart problem. If after installation you see that the wrong image is still being shared, don't worry, it is cached on Facebook and will expire soon. If you want to remove it immediately, go to the URL below.

https://developers.facebook.com/tools/debug/og/object/

Click Get new scrap info to clear the Facebook cache of your specific URL.

Wrong image shared on Facebook via wordpress! Repair

If it shows the wrong image again. Update your particular post on wordpress.

Method 2 -

If you don't want to use any plugins to do this, copy and paste the following code into your function.php file.

//Adding the Open Graph in the Language Attributes function add_opengraph_doctype( $output ) { return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"'; } add_filter('language_attributes', 'add_opengraph_doctype'); //Lets add Open Graph Meta Info function insert_fb_in_head() { global $post; if ( !is_singular()) //if it is not a post or a page return; echo ''; echo ''; echo ''; echo ''; echo ''; if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image $default_image="http://example.com/image.jpg"; //replace this with a default image on your server or an image in your media library echo ''; } else{ $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' ); echo ''; } echo " "; } add_action( 'wp_head', 'insert_fb_in_head', 0 );



Now go to the URL given below and get new scraping information to clear the cache.


https://developers.facebook.com/tools/debug/og/object/

.

add a comment of Wrong image shared on Facebook via wordpress! Repair
Comment sent successfully! We will review it in the next few hours.