Facebook Scraper-clear cache

Published by

Posted on August 17, 2016

If you want to control how your data looks after posting to Facebook. You will want to use the scraper debug tool.

This tool came in handy after a user wanted a particular image to show instead of a random image. The debugger allowed us to see what exactly facebook was pulling. The tool also advise us on some warning and issues we have within our codebase.

We had to edit the functions.php file and had the below snippet .Thanks to https://wordpress.org/support/topic/change-the-og-image-property


add_filter(‘wpseo_pre_analysis_post_content’, ‘mysite_opengraph_content’);
function mysite_opengraph_content($val) {
return preg_replace("/<img[^>]+>/i", "", $val);

We also needed to edit the header.php file and add the below snippet
<meta property="og:image" content="http://example.com/hmm.jpg" />
[/html] **of course changing the values to match our website*

After making the needed changes, you can request a rescrape using the scraper tool. This can also be down via the linux command line with curl. You will need access token for this to work.

curl -F access_token="<token>" -F id="cnn" -F scrape=true https://graph.facebook.com

API Docs

Some of the warning we received were related to Open Graph protocol
Open Graph protocol