Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Facebook Open Graph, Google+ and Twitter Card Tags with Access Token
<?php
/*
If you want the "Facebook Open Graph, Google+ and Twitter Card Tags" WordPress plugin to be able
to clear/update the cache of your posts and pages, you'll need to create a facebook app and add
it's ID and secret to the URL.
1) Go to https://developers.facebook.com/apps/ and create a new app (or choose and existant one, any app will do)
2) Copy the App ID and App Secret from your app dashboard
3) Add this to your (child-)theme's functions.php file and replace MY_APP_ID and MY_APP_SECRET with your app details
*/
add_filter( 'fb_og_update_cache_url', 'my_fb_og_update_cache_url' );
function my_fb_og_update_cache_url( $url ) {
$url .= '&access_token=MY_APP_ID|MY_APP_SECRET';
return $url;
}
@Patasmaggot

This comment has been minimized.

Copy link

Patasmaggot commented Dec 22, 2017

I have to include this file in the plugin directory and you're done?

@makmour

This comment has been minimized.

Copy link

makmour commented Mar 28, 2018

Use the snippet in your child theme functions.php file. You can omit the <?php opening tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.