WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#15726 closed enhancement (fixed)

Allow for "bad slugs" to be blocked in wp_unique_post_slug

Reported by: westi Owned by: westi
Milestone: 3.1 Priority: normal
Severity: minor Version: 3.0.2
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

Depending on server configuration and rewrite configuration there are any number of slugs which won't work well for root pages.

Examples might be wp-admin, wp-content, wp-includes

Attachments (1)

allow_bad_slug_marking.diff (2.0 KB) - added by westi 5 years ago.
Something like this should allow a plugin to handle these and any other collisions

Download all attachments as: .zip

Change History (4)

comment:1 @westi5 years ago

We need to add some hooks to wp_unique_post_slug - one in each of the three branches in these lines similar to this I think:

f ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_slug', false, .... ) {

@westi5 years ago

Something like this should allow a plugin to handle these and any other collisions

comment:2 @ryan5 years ago

Works for me.

comment:3 @westi5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [16960]) Allow a plugin to filter our slugs if it wants to. Fixes #15726

Note: See TracTickets for help on using tickets.