For one of the websites I created, XpatGirls.com, I installed Facebook’s official plugin for WordPress. It’s a nice plugin, that adds some “social” elements to your blog, instead of installing different plugins for different purposes, including:
- Facebook’s Open Graph Protocol
- Insights
- Like, Send and follow buttons
- Recommendation bar etc.
So, I installed the plugin on the website, like I do with almost every website that I build. A couple of weeks later, I found out that WordPress’ pagination was broken. Although the pagination appeared at the bottom of the blog, clicking on the page numbers / previous / next – would do nothing but navigate to the main page. So like everytime there’s a problem with WordPress, I started disabling themes and plugins, in order to isolate the problem, and then resolve it.
How to fix WordPress’ pagination problem caused by Facebook plugin
In the end, I found out that the Facebook plugin was the trouble maker.
To make a long story short, and to make your life easier, try adding the following piece of code to the end of the file functions.php (inside the theme’s folder). It solved my problem, and I hope it’ll solve yours.
function td_pagination_fix() { global $wp_query; unset($wp_query->queried_object); } add_action( 'wp', 'td_pagination_fix', 111 );
I assume it only happens with specific themes, so if you encountered this issue, please mention your theme in the comments below.