WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 9 months ago

#21112 new enhancement

Add pre_wp_unique_post_slug to override post slug handling

Reported by: coffee2code Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.4
Component: Permalinks Keywords: has-patch
Focuses: Cc:

Description

As originally proposed in the comments of #20480 (and in fact further back in a comment for #14111), a pre_wp_unique_post_slug filter early in wp_unique_post_slug()could be useful and justified for some use cases rather than relying on the existing and late-firing wp_unique_post_slug filter for a couple reasons:

  • wp_unique_post_slug() (and thus this new filter) is not high use, so won't impact performance
  • wp_unique_post_slug() performs database queries (perhaps repeatedly until a unique slug is found), fires other filters, etc, all of which may be rendered moot if a hooking function's intent is to fully implement its own slug generation/handling logic. The pre slug could short-circuit that unnecessary effort.

The attached patch introduces the new filter in addition to adding related phpDocs.

Attachments (1)

21112.diff (1007 bytes) - added by coffee2code 22 months ago.

Download all attachments as: .zip

Change History (3)

coffee2code22 months ago

comment:1 johnbillion18 months ago

  • Cc johnbillion added

comment:2 wycks9 months ago

  • Cc bob........ellison@… added
Note: See TracTickets for help on using tickets.