Add pre_wp_unique_post_slug to override post slug handling
|Reported by:||coffee2code||Owned by:|
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.