editable_slug
Filters the editable slug for a post or term.
Note: This is a multi-use hook in that it is leveraged both for editable post URIs and term slugs.
Usage
add_filter( 'editable_slug', 'wp_kama_editable_slug_filter', 10, 2 ); /** * Function for `editable_slug` filter-hook. * * @param string $slug The editable slug. Will be either a term slug or post URI depending upon the context in which it is evaluated. * @param WP_Term|WP_Post $tag Term or post object. * * @return string */ function wp_kama_editable_slug_filter( $slug, $tag ){ // filter... return $slug; }
- $slug(string)
- The editable slug. Will be either a term slug or post URI depending upon the context in which it is evaluated.
- $tag(WP_Term|WP_Post)
- Term or post object.
Changelog
Since 2.6.0 | Introduced. |
Since 4.4.0 | The $tag parameter was added. |
Where the hook is called
In file: /wp-admin/edit-tag-form.php
editable_slug
wp-admin/edit-tag-form.php 165
$slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
wp-admin/includes/class-wp-terms-list-table.php 437
$output .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
wp-admin/includes/class-wp-terms-list-table.php 590
return apply_filters( 'editable_slug', $tag->slug, $tag );
wp-admin/includes/template.php 323
'<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name, $post ) . '</div>
wp-admin/includes/post.php 1498
$uri = apply_filters( 'editable_slug', $uri, $post );
wp-admin/includes/post.php 1506
$permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) );
wp-admin/includes/meta-boxes.php 938
$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
Where the hook is used in WordPress
wp-includes/default-filters.php 309
add_filter( 'editable_slug', 'urldecode' );
wp-includes/default-filters.php 310
add_filter( 'editable_slug', 'esc_textarea' );