WordPress Custom Taxonomy Pagination show 404 page not found error


Recently i’ve a custom WordPress development, it involve quite a number of custom taxonomy and custom post types. If you are familiar with custom taxonomy and post types, most probably you might write your own WPQuery to do custom search and filter and i’m also one of them. Everything is good until i test the custom taxonomy pagination. First listing page for the custom taxonomy is still fine, but when i try to click on page 2, then it show 404 page not found error. Spent hours of time in google and stack overflow, finally i manage to solve the issue.

Advertisements
If you are using Custom Taxonomy and writing your own query, try not to use your own variable to declare the posts_per_page. If you use your own variable and it might have conflict with WordPress default post_per_page option and show 404 page not found error. To solve this, just replace your post_per_page variable to WordPress default post_per_page option and the issue will be solved.

Now, some of you might want to ask, how am i going to modify the default value ?

Just go to “Settings” => “Reading” => and edit the value for “Blog pages show at most”.

Happy coding!




Share this with your friends:-

Leave a Reply