[wp-trac] [WordPress Trac] #20783: Add filter to wp_unique_term_slug()
WordPress Trac
noreply at wordpress.org
Fri May 15 21:05:06 UTC 2015
#20783: Add filter to wp_unique_term_slug()
-------------------------------------+--------------------
Reporter: bolo1988 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.3
Component: Taxonomy | Version: 3.3.2
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+--------------------
Changes (by boonebgorges):
* keywords: has-patch dev-feedback needs-testing => has-patch needs-
testing
* milestone: Awaiting Review => 4.3
Comment:
I like the idea of adding filters here, but I'm going to propose something
a bit different. See [attachment:20783.3.diff].
First, I've rearranged the logic so that we return only once. This allows
us to have just a single `apply_filters()` call on the return value, which
I think is nicer.
Second, I've removed the distinction between the different 'is_bad'
filters. `wp_unique_post_slug()` has branching logic for attachment vs
hierarchical vs non-hierarchical. `wp_unique_term_slug()` doesn't branch
in such a clean way, so having two different filters doesn't make sense to
me. The taxonomy will be available in the `$term` object passed to the
filter, so the callback can make its own distinction if necessary.
Does this reordering make sense, @coffee2code and others?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/20783#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list