[wp-trac] [WordPress Trac] #16323: Hierarchical Custom Post Type Bug - invalid name query var generated

WordPress Trac noreply at wordpress.org
Fri Aug 9 01:02:20 UTC 2013


#16323: Hierarchical Custom Post Type Bug - invalid name query var generated
--------------------------+------------------------------
 Reporter:  jrcowher      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Permalinks    |     Version:  3.0.4
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------------------
Changes (by c3mdigital):

 * keywords:   => needs-patch


Comment:

 I can verify the reporters bug.  Using the pasted code provided by the
 reporter I obtained the following results:

 The name query_var is wrong.

 Request:
 `service/treatments-therapeautic/diagnostics-bulger`

 Query String:
 `name=treatments-therapeautic%2Fdiagnostics-bulger&post_type=service`

 Matched Rewrite Rule:
 `service/(.+?)(/[0-9]+)?/?$`

 Matched Rewrite Query:
 `post_type=service&name=treatments-therapeautic%2Fdiagnostics-
 bulger&page=`

 In the var_dump of the query_vars `'name' => 'treatments-
 therapeauticdiagnostics-bulger`

 Adding this rewrite rule fixes the problem:
 `$rule['service/(.*?)/(.*?)/?$'] =
 'index.php?post_type=service&name=$matches[2]';`

 After the new rule

 Request:
 `service/treatments-therapeautic/diagnostics-bulger`

 Query String:
 `name=diagnostics-bulger&post_type=service`

 Matched Rewrite Rule:
 `service/(.*?)/(.*?)/?$`

 Matched Rewrite Query:
 `post_type=service&name=diagnostics-bulger`

--
Ticket URL: <http://core.trac.wordpress.org/ticket/16323#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list