[wp-trac] [WordPress Trac] #5305: permalinks broken when article name is numeric

WordPress Trac noreply at wordpress.org
Thu Feb 26 20:10:31 UTC 2015


#5305: permalinks broken when article name is numeric
--------------------------+---------------------------
 Reporter:  thomask       |       Owner:  valendesigns
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.2
Component:  Permalinks    |     Version:  2.3.1
 Severity:  major         |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):

 * keywords:  has-patch needs-testing => needs-patch


Comment:

 Coming back to review this, I think there's a problem with the current
 approach. By intervening in `WP_Query::parse_query()`, we make it
 impossible to create a `WP_Query` object whose date params clash with the
 permalink of a post with a numeric slug. See
 `test_numeric_slug_permalink_conflicts_should_only_be_resolved_for_the_main_query()`
 in [attachment:5305.10.diff]. What we are trying to resolve here is
 improperly parsed URLs, but solving the problem in `WP_Query` means that
 we're "fixing" queries that didn't originate in URLs at all.

 I see two possible ways forward:
 1. Move our proposed disambiguation logic to somewhere around the
 'request' filter or 'parse_request' action. The internals will have to
 change a bit.
 2. Keep it in `WP_Query`, but only run it if `is_main_query()`.

 2 is easier, but I don't think it'll be reliable. It won't fix
 `url_to_postid()`, for instance. It looks like 1 could possibly fit into
 `parse_request()` after non-public post_types are filtered out - the
 disambiguation is a similar kind of sanity check.

 valendesigns, do you have thoughts about this?

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


More information about the wp-trac mailing list