Skip to content
This repository was archived by the owner on Aug 18, 2026. It is now read-only.
This repository was archived by the owner on Aug 18, 2026. It is now read-only.

Category_Pager ignores deliberated empty category_base setting #4521

Open

Description

@alexmerz

Describe the bug
In our WordPress setup we have set category_base to an empty string intentional.

This causes an issue with Category_Pager:

if ( empty( $category_base ) ) {

If the category_base is an empty string, the class adds "category" to the URL hardcoded.

This means, we have later to fix the created URL:

add_filter( 'paginate_links', function( $link ) {
    $link = str_replace( '/category/', '/', $link );
    return preg_replace( '/\/$/', '', $link );
}, 10, 1 );

To Reproduce
Steps to reproduce the behavior:

  1. Go to WordPress settings
  2. Set category base to an empty string
  3. Browse Paginated Category pages like example.com/my_category/page/2
  4. Paginated links contain /category/my_category/page/x

Screenshots

Expected behavior
Category_Pages should respect an empty string as an category_base.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions