Fix WordPress pagination issue by Facebook plugin

Fix WordPress pagination issue by Facebook plugin

Some time ago, several of our users complained that pagination on our themes is not working properly. Actually, we have found out that this is not theme related issue and it was caused only if Facebook WordPress plugin was installed and activated on their websites.

Since we were a bit worried about this because it is well known plugin, we have found out that many users or theme authors had the similar problem. And then we came up to solution with handy snippet which will prevent the issue.

When does pagination issue by Facebook WordPress plugin appears?

  • Only on homepage
  • If you are using “Post name” option in Permalink Settings
  • If you are using “Static” homepage option in your Reading Settings which means you are using some custom page template to display your posts in a default loop

The problem with this issue is that WordPress actually generates proper pagination link, (i.e. yourwebsite.com/page/2), but it is somehow always redirected to your home page.

Solution

This handy snippet should do a trick. Make sure it is included somewhere in the functions.php file of your theme.

That’s it! Feel free to try it out and let us know if it works for you!

Bojan Petrovic

Co-founder and WordPress developer at Meks. He has been involved in the business since 2009. creating themes, plugins and services on top of WordPress, continuously aiming to choose best approaches and work smarter, not harder.

3 comments

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *