[wp-trac] [WordPress Trac] #35131: Unexpected 404: pending post hides published post with matching slug
WordPress Trac
noreply at wordpress.org
Mon Feb 22 04:47:55 UTC 2016
#35131: Unexpected 404: pending post hides published post with matching slug
--------------------------+------------------------------
Reporter: bobbingwide | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 4.3.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by boonebgorges):
I'm unable to reproduce the slug conflict in the manner described.
Sometimes WP creates 'pending' posts with empty `post_name` - I think this
happens when the sample permalink is not customized. When this is the
case, there's no slug conflict, since the pending post doesn't have a
slug.
Sometimes WP does save a `post_name` with a pending post. In these cases,
it's not possible to create a published post through the Add New Post
interface using the same slug. The `get_sample_permalink()` ->
`wp_unique_post_slug()` chain prevents it, appending the `-2` suffix.
Am I doing something different from what you're doing?
I'm able to reproduce the `WP_Query` routing problem when I manually
update the database so that there's a slug conflict. I'm not certain it's
a scenario we need to design for.
That being said, [attachment:35131.diff] is an attempt to adjust the
post_status filter logic for the possibility that there may be more than
one post return by a singular-post query, and that the "public" one might
not be at the 0 index. This needs cleanup and probably lots of unit tests.
@bobbingwide Can you take a look to see if this approach addresses your
bug? (It does for me.)
See also #30911.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35131#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list