0

On my Wordpress site, house is a page with short code written in it to paginate a get terms loop.

Currently below urls works perfectly to return 2nd page of the loop

/house/?paged=2    
/index.php?pagename=house&paged=2

Then I added the below

function custom_rewrite_basic() {
add_rewrite_rule('^house/page/([0-9]+)/?$', 'index.php?pagename=house&paged=$matches[1]', 'top');
}
add_action('init', 'custom_rewrite_basic', 10, 0);

However /house/page/2/ still returns 404 not found.

2
  • Did you flush the rewrite rules? Settings -> Permalinks -> Save Changes without any changes. If so, another great debugging step for this kind of thing is to get the plugin wp query monitor, which will show a breakdown of all the rewrite rules WordPress considered in returning the page. You can verify your rule is showing up there at all.
    – tmdesigned
    Feb 9, 2019 at 12:30
  • @tmdesigned you are right, I did not flush the rewrite rules by going to settings and resave permalinks. Now it is working. Thank you so much.
    – Calvin
    Feb 9, 2019 at 12:49

1 Answer 1

0

As answer provided by @tmdesigned in comments above.

An extra step is needed, to go to settings and resave permalinks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.