editable_slug filter-hookWP 2.6.0

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 168
$slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
wp-admin/includes/template.php 321
'<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name, $post ) . '</div>
wp-admin/includes/post.php 1427
$uri = apply_filters( 'editable_slug', $uri, $post );
wp-admin/includes/post.php 1435
$permalink         = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) );
wp-admin/includes/class-wp-terms-list-table.php 426
$out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
wp-admin/includes/class-wp-terms-list-table.php 562
return apply_filters( 'editable_slug', $tag->slug, $tag );
wp-admin/includes/meta-boxes.php 889
$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );

Where the hook is used in WordPress

wp-includes/default-filters.php 299
add_filter( 'editable_slug', 'urldecode' );
wp-includes/default-filters.php 300
add_filter( 'editable_slug', 'esc_textarea' );