Created
August 19, 2014 14:43
-
-
Save NicolasPio/2b833766a16ec4648ce1 to your computer and use it in GitHub Desktop.
Clear the cache of the Facebook Open Graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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