0

I freshly installed WordPress and checked for multipage post, which is separated by <!--nextpage-->.

I'm expecting first URL should be:

example.com/wordpress/this-is-test/1/
example.com/wordpress/this-is-test/2/
and so on...

But when I use example.com/wordpress/this-is-test/1/, it automatically redirect to example.com/wordpress/this-is-test/.

How can I keep the /1/ at the end?

4
  • yes it's possible. One has to modify the canonical redirect via the canonical_redirect filter. Then there are some adjustments needed via the filters of wp_link_pages().
    – birgire
    Commented Sep 24, 2016 at 10:45
  • Thanks @birgire. Can you provide me simple example please?
    – CyberHelp
    Commented Sep 25, 2016 at 13:59
  • Please show some research and what you've tried so far and explain where you stopped. Thanks
    – birgire
    Commented Sep 25, 2016 at 14:20
  • @birgire I have tried to catch canonical_redirect url using: add_filter( 'redirect_canonical', array( $this, 'filter_canonical' ), 19, 2 ); try to get and print redirect_url from args and exit() but it redirected without exit()
    – CyberHelp
    Commented Sep 26, 2016 at 13:11

1 Answer 1

0

Your expectation isn't right. Numbers are only added to pages 2 & higher. The first page retains the single page's slug.

2
  • Thanks Andy,but I am going to display all the content of the page when we don't have numbers at the end. If numbers at the end I'll display that page content.
    – CyberHelp
    Commented Sep 23, 2016 at 17:15
  • Ah. A subtle English distinction. Sorry :-) Commented Sep 23, 2016 at 18:34

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.