How to successfully update the Facebook sharing cache while using our Facebook Open Graph plugin for WordPress

Why this post?

A few months ago, Facebook stopped allowing updating the sharing cache for a URL programmatically, which caused this particular functionality of our “Facebook Open Graph, Google+ and Twitter Card Tags” plugin to stop working.

If you’re not using our plugin, you should just get it, otherwise the information on this post is not for you. Have a nice day 🙂

Each time you update a post on your WordPress website, our plugin makes a call to a specific Graph API URL telling Facebook that the post was updated and that they should scrap it again, in order to get the updated details of that post, thus providing a correct preview when that content is shared on Facebook.

But because Facebook made some changes on their side (go figure…), you are probably getting an error each time you update a post on your website.

Facebook error

(You can still click on the “Manually update Facebook cache” and be done with it)

We found a solution

Basically, Facebook no longer allows updating the cache anonymously, so you have to use an App ID and Secret to do it.

On version 2.1.4.4 we’ve created a filter (fb_og_update_cache_url) that allow advanced users to authenticate the call with an App ID and App Secret of their own, thus bringing this functionality back to life.

After some weeks of testing, we can confirm that this method works, and we decided to add settings to our plugin, on version 2.1.6, that allows setting your own App ID and Secret to authenticate the calls, instead of having to use the filter.

If you are currently using the filter, these settings will NOT be used. You should stop using the filter and use the settings instead.

We decided to write this blog post explaining how to create your own Facebook App, and how to use the app details in our plugin.
Please be advised that no further support will be provided on this. All you need to know is in this blog post.

If you are not comfortable following the steps, please do not do it, and just manually update the cache of your URLs on the Facebook Sharing Debugger.

Step 1: Create your own Facebook App

If you already have a Facebook App, you can skip this step. Any App will do. You don’t have to create a specific app for this. Just skip this step and use your existing App ID and Secret on step 2.

Go to https://developers.facebook.com/apps/ click on “+ Add a New App”, fill a name of your choice and your email, click on “Create App ID”.

Add a new Facebook App

If you manage multiple WordPress websites, you do NOT need to create a new App for each website. Just use the same App ID and Secret on all of them.

Step 2: Get the App details

Go to your App Dashboard and copy both the App ID and the App Secret. You’ll have to click on “Show” to get the App Secret.

Get the App ID and Secret

Step 3: Configure the plugin

Go to our plugin settings page on “Settings” -> “Facebook Open Graph, Google+ and Twitter Card Tags” -> “Open Graph” tab -> “Facebook Open Graph Tags cache” panel, activate the “Clear cache” option and fill in your App details.

Fill the details

And that’s it. Your website should now be able to clear the Facebook sharing cache each time you update a post.

Facebook Open Graph Tags updated

It’s possible that you still get an error when you create a new post, because the plugin will be trying to flush the cache on something that has never been shared to Facebook, but if you update it again, it will work just fine.

Facebook sharing preview

Step 4: Drink a beer…

… or any other drink of your choice.

If you want us to join you on that beer, go to the plugin settings page and click on that nice PayPal “Donate” button on the bottom right of the screen.

Also, do not forget to give us a 5 stars rating on WordPress.org 🙂

19 comentários a How to successfully update the Facebook sharing cache while using our Facebook Open Graph plugin for WordPress

  1. Luca 2018-01-11 às 11:53 #

    Hi, I tried to get it as you suggested but it seems don’t work fine. I see always the same debug errors on facebook for developers (missing og:description, fb:app_id) even if I added App Id and secret and scraped the post.
    Do you have any suggestions?
    Thanks a lot

  2. Webdados 2018-01-11 às 12:25 #

    Hi there Luca,

    This is not a support forum and the errors you mention (missing og:description …) are not related to this post subject.
    Please use the support forum at wordpress.org

  3. Luca 2018-01-11 às 16:20 #

    Ok, thanks I’m going to do it!

  4. Tom 2018-02-19 às 19:48 #

    I cannot find the filter settings to deactivate the fb_og_update_cache_url?

  5. Webdados 2018-02-19 às 20:09 #

    Hi there Tom,

    Please use the support forum at wordpress.org

  6. Jeff Staebell 2018-06-01 às 14:50 #

    This post needs to be updated because when I click on the link to get the App ID and Secret there’s a lot more to it. I finally figured out how to get to the screen shot and have an App ID but cannot find anywhere to get the Secret so I guess I’ll just spend countless more time trying to figure out how to get this to work.

  7. Jack Bobeck 2018-08-16 às 11:41 #

    I was able to find the App ID and Secret by doing most of what was said above and by using the Youtube video here, https://www.youtube.com/watch?v=kQ4s-8Cb5-o

  8. DeeDee Weber 2019-03-15 às 15:49 #

    This is incomplete or facebook changed. Step 2, none of this shows anywhere on my screen. You’ve either not give complete steps to locate or it has changed.

  9. huxi hall 2019-04-24 às 09:21 #

    I made the same experince like DeeDee Weber. Facebook seems to change the system …

  10. Alfredo 2019-11-26 às 11:32 #

    Hello. I have read the gude and all works fine. I have only a problem…when the post is changed and upadated I lost all previous likes and shares…there i s a way to set this?
    Thanks and regards,

  11. Marco Almeida 2019-11-26 às 11:41 #

    That is very weird and not supposed to happen at all.
    Maybe you’re changing the URL?

  12. Williams 2020-01-17 às 15:17 #

    Hello!
    if i take a link from the article and shorten it with bit.ly then sharing this link on whatsapp will work?

  13. Marco Almeida 2020-01-17 às 15:42 #

    You’ll have to try it

  14. Michael 2020-03-02 às 07:32 #

    Thank you! Facebook is working fine, but i get still no image on twitter … Do i have to make any settings?

  15. Marco Almeida 2020-03-02 às 09:31 #

    You need to have the Twitter Card options activated.

  16. Branislav 2020-03-05 às 08:59 #

    Hello, how can I make my facebook image look like on Higher Perspective ( it looks like vertical image, but stil it’s clickable non paid link)
    https://www.facebook.com/HigherPerspective/

  17. Marco Almeida 2020-03-05 às 12:47 #

    They edited the Facebook post after and changed the image. It’s not possible to do it automatically.

  18. rohan desai 2020-04-30 às 16:44 #

    is it possible to use same app id and app secret on multiple wordpress websites?

  19. Marco Almeida 2020-04-30 às 19:11 #

    Yes

Deixe um comentário

*

_