Since the beginning of 2014 many WordPress bloggers experience an issue with sharing WordPress posts to Facebook. Instead of a newly published post, something like “Page not found” and a default image appear.
First, what is definitely not the source of the problem:
- sharing plugins (Jetpack Publicize, Shareaholic, official Facebook plugin, and lots of others),
- plugins that are responsible for placing relevant open graph tags to the head of your blog post (Yoast and other SEO plugins, for example).
Don’t start to dig into how these plugins share the post, or which data they pull to open graph tags. They are not to be blamed for the issue.
For most bloggers, including me, the “Page not found” problem applies only to scheduled posts. The posts published immediately are shared on Facebook properly.
What is the causing WordPress to Facebook sharing issue?
It’s how WordPress deals with scheduled posts, and when Facebook scrapes the content of the post.
Here is what happens.
1. You write a post. When you change the status from Draft to Scheduled (hit Publish button when the publish date is set in the future), the post is available in the front end under its final permalink.
2. WordPress deals with scheduled posts in a very specific way. The scheduled post is “triggered by the first visit to your blog on or after the exact date/time you set.”
So, if you set the publish time to 17:00, it doesn’t mean the post will be published at 17:00. If a first visitor comes to your blog at 17:46, your new post will be published at 17:46.
3. Now, here is the essence of the problem. When you visit your scheduled post in the front end at its final permalink, Facebook get prompted to scrape it.
I can only explain it with a fact, that if a WordPress blog has many users, if someone else than post’s author is visiting the post from the front end, that is counted as a visit to a public post.
4. Facebook is told to scrape the post, but the post is not published yet. It means it doesn’t exist at its final permalink to anyone besides its author.
5. Facebook gets redirected to 404 page – and scrapes the content of that page.
You can easily check out if this issue applies to your case. Go to your 404 page – simply go to any blog post and add something at the end of its url address. The page with this address doesn’t exist and you’ll land on 404.
Then try to share the 404 page on Facebook. Analyze what is being shown to what is being shown when a scheduled post is shared. My other blog, Ebook Friendly, where I have the issue, displays the content from “scheduled post ⇢ 404 page” like this:
When the post is being published, and auto-posting plugins try to share it, Facebook pulls the cached content of what it thinks is the post it visited and scraped already.
You can easily refresh the content by visiting Facebook Debugger, pasting the post’s url and refreshing the page a couple of times. After Facebook Debugger says there are no more issues with your post, it’ll get shared properly.
But going to Facebook Debugger every time after the scheduled post is published doesn’t make sense, right?
Some bloggers have reported that they were solving the problem when they went in WP dashboard to Settings / Permalinks and just hit Save Changes button. But, again, doing it every time doesn’t make sense.
I haven’t found any piece of working code that would flush the Facebook cache after the post’s status changed from Scheduled to Published. Or that would prevent Facebook from scraping the scheduled post.
Shareaholic plugin has implemented a solution in 22.214.171.124 version: “Bugfix: Fixed annoying bug where Facebook was trying to cache scheduled posts before they were live.” So, at least the users of this plugin have the issue fixed.
For the time being, my best advice is to work on a draft post to the very end, and leave scheduling after everything else is done. If you don’t visit the scheduled post at its final permalink, you won’t have problems with sharing it to Facebook.
So, you can visit the post in the front end when it’s draft and its url is something like http://myblog.com/?p=12345&preview=true.
Don’t visit the scheduled post when its url is http://myblog.com/the-final-permalink.
You’ll also have a problem if you’ll visit the preview of the scheduled post: http://myblog.com/the-final-permalink?preview=true.
I know some bloggers schedule their posts to some time in the future to prevent publishing a post immediately if they accidentally hit the Publish button. It happened to me a couple of times, but I’ve found a nice workaround: why not make Save Draft button more prominent than Publish?
If I found any better solution, I’ll share it immediately, so stay tuned.
Check out more WordPress tips: