[wp-trac] [WordPress Trac] #58813: Editing Slug to an Existing Slug causes wrong content to display
WordPress Trac
noreply at wordpress.org
Wed Jul 19 17:50:55 UTC 2023
#58813: Editing Slug to an Existing Slug causes wrong content to display
--------------------------+------------------------------
Reporter: Ipstenu | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by Ipstenu):
Changing this:
{{{
function wp_unique_post_slug( $slug, $post_id, $post_status, $post_type,
$post_parent ) {
if ( in_array( $post_status, array( 'draft', 'pending', 'auto-
draft' ), true )
|| ( 'inherit' === $post_status && 'revision' ===
$post_type ) || 'user_request' === $post_type
) {
return $slug;
}
}}}
to this:
{{{
function wp_unique_post_slug( $slug, $post_id, $post_status, $post_type,
$post_parent ) {
if ( in_array( $post_status, array( 'auto-draft' ), true )
|| ( 'inherit' === $post_status && 'revision' ===
$post_type ) || 'user_request' === $post_type
) {
return $slug;
}
}}}
works, except that it doesn't fill in the slug 'block' (the one that shows
the current post slug) until you either edit the permalink or publish,
which isn't a good UX.
There's also the frustrating issue where the filter doesn't exist until
**AFTER** it checks for post status, so you can never filter on those.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58813#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list