[wp-trac] [WordPress Trac] #45819: when {category|tag}_base include spaces their rewrite rules don't get generated correctly, resulting in 404's

WordPress Trac noreply at wordpress.org
Thu Jan 3 17:00:58 UTC 2019


#45819: when {category|tag}_base include spaces their rewrite rules don't get
generated correctly, resulting in 404's
--------------------------+-----------------------------
 Reporter:  pbiron        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Permalinks    |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Steps to reproduce:

 1. Go to Settings > Permalinks
 2. Enter "this is a test" in the `category_base` field
 3. Click "Save Changes"
 4. Notice that `category_base` gets saved as "this%20is%20a%20test".
 5. Notice that the rewrite rules such as the following get generated:
 {{{
 'this%20is%20a%test/(.+?)?$' =>
 'index.php?%20was%$matches[1]&%20test%$matches[2]'
 }}}
 instead of (what I imagine the correct rule would be)
 {{{
 'this%20is%20a%test/(.+?)?$' => 'index.php?category_name=$matches[1]
 }}}

 I'm not sure whether the best thing to do is to disallow spaces in
 `{category|tag}_base` or to fix`WP_Rewrite::generate_rewrite_rules()` to
 generate correct rules if they do include spaces.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45819>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list