i'm using pagination for very long posts. So i have a problem here. I'm not happy with standard utl structure (where is couple personal reasons for that in my project). For example, i have post


and i need to get second page of it with




I'm sure that i won't create post/page with slug post2 How can i change standard url in a such way? I tried this

add_action( 'init', 'wpa5413_init' );
function wpa5413_init()

But it doesn't work...

1 Answer 1


Your rewrite rule format is not correct. The $rewrite argument must point to index.php with query vars set so WordPress can create the default query:

add_action( 'init', 'wpa103850_init' );
function wpa103850_init()

However, this will still not work correctly, due to the canonical redirect. WordPress wants to enforce a single URL for any given post/page. You'll have to remove that filter to prevent that from happening, but note that this will have other possibly undesirable side-effects, as no canonical redirects will happen.

remove_filter( 'template_redirect', 'redirect_canonical' );

It may be possible to selectively apply the canonical redirect, but I haven't the time to go digging in source at the moment to determine that!

  • thank you, i've already realized my mistake :) can you give an advice about changing link structure in wp_link_pages, i need to change it in a new way "post.htm/2" -> "post2.htm" Commented Jun 22, 2013 at 15:15
  • I don't think you can filter that function to set your own format, you'll have to generate the links yourself manually. start by looking at the function in source and create your own based on that.
    – Milo
    Commented Jun 22, 2013 at 15:20

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.