0

I'd like to have the following:

Single Post test.com/blog/new-category/post-name/

Category test.com/blog/new-category/

So I changed the Permalink structure to: /blog/%category%/%postname%/ and the category base to blog. But this gives me a 404 on the post.

So I tried blog/. for the category base, which works. But only for the first page. On the second page it gives me a 404 for test.com/blog/new-category/page/2/.

I guess WP is looking for a post with the slug page/2/.

Does anybody had a similar problem and may know a solution?

Thanks!

  • How do you implement the pagination? – Max Yudin Aug 17 '16 at 15:39
  • <p id="pagination"><?php echo paginate_links(); ?></p> Isn't that the right way? – Nico Martin Aug 17 '16 at 15:49
  • I changed the 'format' => '?paged=%#%' but this only gives a redirect to /page/2/ – Nico Martin Aug 17 '16 at 15:58
0
  • Change Category base to . (dot). Nobody knows this trick will work in the future, but there is no easy way to remove /category/ from the URL. So, it's better to google for a plugin (here is one of them). Yoast's SEO plugin also is able do the same.

  • Set Permalink structure to /blog/%category%/%postname%/.

Then:

the_posts_pagination();

This function does not require any arguments in your case.

If you really want to use paginate_links(), use the right format argument value because pretty permalinks were already set: page/%#%/ rather than ?paged=%#%:

echo paginate_links( array('format' => 'page/%#%/') );

See Pagination functions for more.

| improve this answer | |
  • When I remove the Category base I have a Category Permalink linke thant: blog/category/neue-kategorie/ - blog/category/neue-kategorie/page/2/ which does not make sence since blog/category/ gives me a 404 (no logical structure). And whats the advantage of the_posts_pagination();? – Nico Martin Aug 18 '16 at 3:26
  • I see. I've updated the answer. – Max Yudin Aug 18 '16 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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