editable_slug хук-фильтрWP 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.

Использование

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(строка)
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.

Список изменений

С версии 2.6.0 Введена.
С версии 4.4.0 The $tag parameter was added.

Где вызывается хук

В файле: /wp-admin/edit-tag-form.php
editable_slug
wp-admin/edit-tag-form.php 169
$slug = isset( $tag->slug ) ? 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 1483
$uri = apply_filters( 'editable_slug', $uri, $post );
wp-admin/includes/post.php 1491
$permalink         = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) );
wp-admin/includes/class-wp-terms-list-table.php 436
$output .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
wp-admin/includes/class-wp-terms-list-table.php 589
return apply_filters( 'editable_slug', $tag->slug, $tag );
wp-admin/includes/meta-boxes.php 938
$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );

Где используется хук в WordPress

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