[wp-trac] [WordPress Trac] #50943: bug in rewrite rules

WordPress Trac noreply at wordpress.org
Wed Aug 12 13:46:46 UTC 2020


#50943: bug in rewrite rules
---------------------------+-----------------------------
 Reporter:  shahryarhn     |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:  5.5
 Severity:  critical       |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Hi
 I'd found out a new bug in wordpress v5.5 (latest release update), and its
 related to rewrite rules.
 Even sample codes in following page won't work for passing multiple params
 in url mentioned in "Using Custom Templates with custom querystring"
 section:
 https://codex.wordpress.org/Rewrite_API/add_rewrite_rule

 I'd tried every possible ways to achieve that, but I couldn't. I think
 it's a bug. I hope this is not a false report. if it is, sorry for that
 and could you help me.

 I using this code:

 {{{#!php
 <?php
 add_action('init', function ()
 {
     add_rewrite_tag('%page%', '([^&]+)');
     add_rewrite_tag('%args%', '([^&]+)');

     add_rewrite_rule(
         '^auth/?([^/]*)/?$',
         'index.php?pagename=auth&page=$matches[1]',
         'top'
     );
     add_rewrite_rule(
         '^profile/([^/]*)/?([^/]*)/?$',
         'index.php?pagename=profile&page=$matches[1]&args=$matches[2]',
         'top'
     );
 }, 10, 0);
 }}}



 as you can see, I have two page with two different rewrite rules.

 in wordpress v5.4 it works very well, but in new version, it don't.

 Best regards

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


More information about the wp-trac mailing list