[wp-trac] [WordPress Trac] #16839: Category Base Should be Slugified

WordPress Trac noreply at wordpress.org
Tue Jan 20 06:05:07 UTC 2026


#16839: Category Base Should be Slugified
-------------------------------------------------+-------------------------
 Reporter:  miklb                                |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Rewrite Rules                        |     Version:  3.1
 Severity:  normal                               |  Resolution:
 Keywords:  early needs-docs needs-unit-tests    |     Focuses:
  has-patch                                      |
-------------------------------------------------+-------------------------
Changes (by huzaifaalmesbah):

 * keywords:  early needs-docs needs-testing needs-unit-tests has-patch =>
     early needs-docs needs-unit-tests has-patch


Comment:

 == Test Report

 Patch tested: https://github.com/WordPress/wordpress-develop/pull/9797

 === Steps to Reproduce / Test

 1. Navigate to **Settings → Permalinks**.
 2. Under **Category base**, enter a value containing trailing whitespace,
 for example:
    `Foo Bar `
 3. Save the permalinks settings.
 4. Go to **Posts → Categories**.
 5. Click **View** on any category.


 === Expected Results

 * The category archive page should load correctly.
 * Extra whitespace in the category base should be sanitized.
 * The generated category URL should be valid and accessible.

 === Environment
 - WordPress: 7.0-alpha-61215-src
 - PHP: 8.2.29
 - Server: nginx/1.29.4
 - Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 143.0.0.0
 - OS: macOS
 - Theme: Twenty Twenty 3.0
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.1


 === Actual Results

 **Before applying the patch**

 * ❌ The category archive page does not load.
 * ❌ Invalid category URLs are generated when the category base contains
 whitespace.

 **After applying the patch**

 * ✅ Whitespace is properly trimmed.
 * ✅ Category URLs are generated correctly.
 * ✅ Category archive pages load as expected.

 === Screencast

 Before applying patch:
 https://files.catbox.moe/9envj5.mp4

 After applying patch:
 https://files.catbox.moe/8n6e6r.mp4

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/16839#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list