When applying the `'editable_slug'` filter, add a second param that provides more context.
Props MikeSchinkel, jesin. Fixes #31568. Built from https://develop.svn.wordpress.org/trunk@34319 git-svn-id: http://core.svn.wordpress.org/trunk@34283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
170a2cc4be
commit
d28e914a06
|
@ -121,11 +121,13 @@ do_action( "{$taxonomy}_term_edit_form_tag" );
|
||||||
* post URIs and term slugs.
|
* post URIs and term slugs.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
|
* @since 4.4.0 The `$tag` parameter was added.
|
||||||
*
|
*
|
||||||
* @param string $slug The editable slug. Will be either a term slug or post URI depending
|
* @param string $slug The editable slug. Will be either a term slug or post URI depending
|
||||||
* upon the context in which it is evaluated.
|
* upon the context in which it is evaluated.
|
||||||
|
* @param object|WP_Post $tag Term or WP_Post object.
|
||||||
*/
|
*/
|
||||||
$slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug ) : '';
|
$slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
|
||||||
?>
|
?>
|
||||||
<td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
|
<td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
|
||||||
<p class="description"><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
|
<p class="description"><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
|
||||||
|
|
|
@ -373,7 +373,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
$out .= '<div class="name">' . $qe_data->name . '</div>';
|
$out .= '<div class="name">' . $qe_data->name . '</div>';
|
||||||
|
|
||||||
/** This filter is documented in wp-admin/edit-tag-form.php */
|
/** This filter is documented in wp-admin/edit-tag-form.php */
|
||||||
$out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug ) . '</div>';
|
$out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
|
||||||
$out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
|
$out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
|
@ -471,7 +471,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
*/
|
*/
|
||||||
public function column_slug( $tag ) {
|
public function column_slug( $tag ) {
|
||||||
/** This filter is documented in wp-admin/edit-tag-form.php */
|
/** This filter is documented in wp-admin/edit-tag-form.php */
|
||||||
return apply_filters( 'editable_slug', $tag->slug );
|
return apply_filters( 'editable_slug', $tag->slug, $tag );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -694,8 +694,9 @@ function post_comment_meta_box( $post ) {
|
||||||
*/
|
*/
|
||||||
function post_slug_meta_box($post) {
|
function post_slug_meta_box($post) {
|
||||||
/** This filter is documented in wp-admin/edit-tag-form.php */
|
/** This filter is documented in wp-admin/edit-tag-form.php */
|
||||||
|
$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
|
||||||
?>
|
?>
|
||||||
<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( apply_filters( 'editable_slug', $post->post_name ) ); ?>" />
|
<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1243,14 +1243,14 @@ function get_sample_permalink($id, $title = null, $name = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This filter is documented in wp-admin/edit-tag-form.php */
|
/** This filter is documented in wp-admin/edit-tag-form.php */
|
||||||
$uri = apply_filters( 'editable_slug', $uri );
|
$uri = apply_filters( 'editable_slug', $uri, $post );
|
||||||
if ( !empty($uri) )
|
if ( !empty($uri) )
|
||||||
$uri .= '/';
|
$uri .= '/';
|
||||||
$permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
|
$permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This filter is documented in wp-admin/edit-tag-form.php */
|
/** This filter is documented in wp-admin/edit-tag-form.php */
|
||||||
$permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name ) );
|
$permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name, $post ) );
|
||||||
$post->post_status = $original_status;
|
$post->post_status = $original_status;
|
||||||
$post->post_date = $original_date;
|
$post->post_date = $original_date;
|
||||||
$post->post_name = $original_name;
|
$post->post_name = $original_name;
|
||||||
|
|
|
@ -273,8 +273,9 @@ function get_inline_data($post) {
|
||||||
/** This filter is documented in wp-admin/edit-tag-form.php */
|
/** This filter is documented in wp-admin/edit-tag-form.php */
|
||||||
echo '
|
echo '
|
||||||
<div class="hidden" id="inline_' . $post->ID . '">
|
<div class="hidden" id="inline_' . $post->ID . '">
|
||||||
<div class="post_title">' . $title . '</div>
|
<div class="post_title">' . $title . '</div>' .
|
||||||
<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name ) . '</div>
|
/** This filter is documented in wp-admin/edit-tag-form.php */
|
||||||
|
'<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name, $post ) . '</div>
|
||||||
<div class="post_author">' . $post->post_author . '</div>
|
<div class="post_author">' . $post->post_author . '</div>
|
||||||
<div class="comment_status">' . esc_html( $post->comment_status ) . '</div>
|
<div class="comment_status">' . esc_html( $post->comment_status ) . '</div>
|
||||||
<div class="ping_status">' . esc_html( $post->ping_status ) . '</div>
|
<div class="ping_status">' . esc_html( $post->ping_status ) . '</div>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34318';
|
$wp_version = '4.4-alpha-34319';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue