Skip to content

Instantly share code, notes, and snippets.

@NicolasPio
Created August 19, 2014 14:43
Show Gist options
  • Select an option

  • Save NicolasPio/2b833766a16ec4648ce1 to your computer and use it in GitHub Desktop.

Select an option

Save NicolasPio/2b833766a16ec4648ce1 to your computer and use it in GitHub Desktop.
Clear the cache of the Facebook Open Graph
<?php
function clear_cache_facebook($post_id) {
$url = get_permalink($post_id);
$fb_graph_url = "https://graph.facebook.com/?id=". urlencode($url) ."&scrape=true";
$result = wp_remote_post($fb_graph_url);
}
add_filter('publish_post', 'clear_cache_facebook');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment