Permalink/Pagination issue: Category base name same as page name

I currently have a page called “Blog” (slug “blog”), which loads a index.php. All posts in index.php belong to only one post category. A sidebar on index.php contains category links (via wp_list_categories) which load archive.php for that given taxonomy.

The problem I am running into is that I currently have the category base name set to the same slug as the page: “blog”. I am aware that this can cause issues with the rewrite rules, but for the most part everything looks fine. The only issue is with pagination pages for index.php (mysite.com/blog/page/2 does not work while mysite.com/blog/foo-category/page/2 works fine).

Read More

Is there a rewrite rule that can help with my current situation? And if so some help would be appreciated.

If this is a bad idea, please speak up as well. I was hoping to achieve a somewhat RESTful url structure, but wordpresses permalink structure doesn’t appear to be the most flexible.

Thanks

Related posts

1 comment

  1. This is untested, but should work for you. Visit the permalinks settings page to flush rewrite rules after adding:

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

Comments are closed.