How to Post Links to Facebook and Clear Facebook’s Cache
When posting a link from your website to your Facebook thread, Facebook automatically scrapes the link for relevant meta data (a title and an excerpt), and a viable image. This is all good and well, but it presupposes that you have relevant meta data and a viable image. Often, Facebook ends up scraping and displaying meta data and images that aren’t your first choice.
So, how do you ensure that you have both the correct meta data and a valid image? For WordPressers, this is where the Yoast SEO plugin saves the day (again).
By writing a custom SEO Title and meta description via the Yoast SEO panel in your post’s editor, you can ensure that the correct meta data will display in Facebook. Just scroll down to the Yoast SEO panel and click “Edit snippet” (assuming the plugin is already installed).
In terms of your image, simply click of the social sharing icon…
…and upload your image.
Note, the image required for Facebook is 1200px by 630px. (The plugin description reminds you of these specs, so there’s no need to make a note.) If the image is smaller than this, Facebook may scrape in another less suitable image.
(BTW, adding a 1200px by 630px image via the Featured Image tool will work too. You’ll find this option in your WordPress editor below Categories and Tags in the right-hand sidebar. In other words, if you prefer to add a Featured Image, you won’t need to add the image via the Yoast SEO plugin. Just make sure you use a 1200px by 630px image. And should the Featured Image not work for some reason, you have a backup plan.)
Facebook will now scrape in the meta data you want to display. Yay!
But … yes, there’s sometimes a but.
What happens if you’ve already added the link and the wrong meta data and/or image was scraped?
Facebook’s Debug Tool
Facebook’s caching system is notoriously resilient. But never fear, Facebook has provided a debugging tool to “flush the cache”.
Simply go to this link and add the URL in question: https://developers.facebook.com/tools/debug/ (bookmark it, you’ll need it).
After pressing the blue “Debug” button, you’ll get a version of the following:
If the meta data and/or image is incorrect in the Link Preview, first correct it via the Yoast SEO plugin as mentioned above. (If you use a caching plugin on your site, you will need to need clear your site’s cache after adding the correct data and image).
Then press the “Scrape Again” button. (You may have to do this several times before the new corrected info and image appears. Sometimes, you may have to wait a few minutes, and reopen the Debugging Tool link, and reinsert your link.)
Note, this doesn’t automatically correct the erroneous meta data and image of your post in your Facebook thread. You will need to delete the original post and re-post it.
(BTW, don’t worry about any warning messages in the Debug Tool. For example, you’ll get the “Share App ID Missing” warning even if you don’t use an app.)
Hope that helps!
PS. A Twitter user? Twitter also has a debug tool. Logged in to your Twitter account, click here.