[wp-trac] [WordPress Trac] #21112: Add pre_wp_unique_post_slug to override post slug handling

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 29 14:38:33 UTC 2012


#21112: Add pre_wp_unique_post_slug to override post slug handling
-------------------------+-----------------------------
 Reporter:  coffee2code  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Permalinks   |    Version:  3.4
 Severity:  normal       |   Keywords:  has-patch
-------------------------+-----------------------------
 As originally [http://core.trac.wordpress.org/ticket/20480#comment:4
 proposed] in the comments of #20480 (and in fact further back in a
 [http://core.trac.wordpress.org/ticket/14111#comment:4 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21112>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list