Opened 10 years ago
Closed 9 years ago
#31568 closed enhancement (fixed)
Add a 2nd parameter to 'editable_slug' filter for context
Reported by: | MikeSchinkel | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | General | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
I am finding cases where I ideally would prefer to know the explicit context for an editable slug rather than have to depend on global context, which in certain cases could be wrong.
The 'editable_slug'
filter processes the slugs for $post
and $tag
objects where it is used in core so the attached patch adds in a 2nd parameter when calling apply_filters( 'editable_slug', $slug )
in each of the seven (7) places in WP core where the filter is used.
The primary benefit of this patch will be to allow plugins and theme authors to write more robust code that will not fail during the edge cases where the global values are not consistent with the call that triggers the filter.
Attachments (2)
Change History (7)
#1
@
10 years ago
- Component changed from Rewrite Rules to Taxonomy
- Keywords has-patch needs-docs added
Hi Mike,
Looks like you missed adding the new parameter to the hook doc, which is wp-admin/edit-tag-form.php. You'll also need to add @param
and changeset entries to the hook doc for the new parameter. e.g.
@since 4.2.0 The `$object` parameter was added.
and
@param object|WP_Post $object Term or WP_Post object.
#2
@
10 years ago
- Component changed from Taxonomy to General
I guess I'll go with General since this hook is used all over the place.
#3
@
10 years ago
- Keywords needs-docs removed
Patch 31568.diff seems to made from an old version of WordPress (rev 25569) and didn't apply for me.
Patch 31568.2.diff was created from the latest trunk and contains hook docs as per DrewAPicture's instructions.
Patch to add a 2nd parameter to
editable_slug
filter calls