• Resolved vickymp

    (@vickymp)


    Hello! I`m have a page form my CPT Archive, i use a post card to showing the post, but when i active de pagination is only display the first page, when you try to see the other pages returns “page no found”.
    I already desactive “has archive” from my CPT.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author wpexplorer

    (@wpexplorer)

    Hi,

    Pagination issues happen if your page has the same name as your CPT. So for example if your post type is “services” and your page is also “services” it causes a conflict in WordPress. If you change your page slug does the pagination work? If so, then this is what’s going on.

    It’s possible to fix this WP issue though using custom code. Example:

    add_rewrite_rule(
    	'^services/page/(\d+)/?$',
    	'index.php?pagename=services&paged=$matches[1]',
    	'top'
    );

    This code would be added to your child theme functions.php file or via a plugin such as the Code Snippets plugin.

    * Add the code to your site.
    * Change “services” to your page name.
    * Go to Settings > Permalinks and re-save.

    The reason the plugin doesn’t add this type of code to the site automatically is because it could have some potential side affects. There is a reason why WordPress by default doesn’t allow this by default. So it’s best to do this on a per-situation basis.

    – AJ

    • This reply was modified 2 years, 3 months ago by wpexplorer.
    • This reply was modified 2 years, 3 months ago by wpexplorer.
    Plugin Author wpexplorer

    (@wpexplorer)

    Edit: I noticed an issue in the snippet i posted above so I just updated it.

    Thread Starter vickymp

    (@vickymp)

    Thank you very much for your time and help, the code worked perfect!

    Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination in Page for a CPT Archive doesn’t work’ is closed to new replies.