Make Categories/Tags columns on edit.php properly aware of post types. Also ensure AJAX add-tag on edit-tags.php is given the post type. fixes #14061 for trunk.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2ff7c13096
commit
57bc2fd164
|
@ -552,7 +552,7 @@ case 'add-link-cat' : // From Blogroll -> Categories
|
||||||
break;
|
break;
|
||||||
case 'add-tag' : // From Manage->Tags
|
case 'add-tag' : // From Manage->Tags
|
||||||
check_ajax_referer( 'add-tag' );
|
check_ajax_referer( 'add-tag' );
|
||||||
|
$post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
|
||||||
$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
|
$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
|
||||||
$tax = get_taxonomy($taxonomy);
|
$tax = get_taxonomy($taxonomy);
|
||||||
|
|
||||||
|
|
|
@ -382,6 +382,7 @@ if ( current_user_can($tax->cap->edit_terms) ) {
|
||||||
<input type="hidden" name="action" value="add-tag" />
|
<input type="hidden" name="action" value="add-tag" />
|
||||||
<input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" />
|
<input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" />
|
||||||
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
|
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
|
||||||
|
<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
|
||||||
<?php wp_nonce_field('add-tag'); ?>
|
<?php wp_nonce_field('add-tag'); ?>
|
||||||
|
|
||||||
<div class="form-field form-required">
|
<div class="form-field form-required">
|
||||||
|
|
|
@ -1389,7 +1389,7 @@ function _post_row($a_post, $pending_comments, $mode) {
|
||||||
if ( !empty( $categories ) ) {
|
if ( !empty( $categories ) ) {
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach ( $categories as $c )
|
foreach ( $categories as $c )
|
||||||
$out[] = "<a href='edit.php?category_name=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . '</a>';
|
$out[] = "<a href='edit.php?post_type={$post->post_type}&category_name={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . '</a>';
|
||||||
echo join( ', ', $out );
|
echo join( ', ', $out );
|
||||||
} else {
|
} else {
|
||||||
_e('Uncategorized');
|
_e('Uncategorized');
|
||||||
|
@ -1405,7 +1405,7 @@ function _post_row($a_post, $pending_comments, $mode) {
|
||||||
if ( !empty( $tags ) ) {
|
if ( !empty( $tags ) ) {
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach ( $tags as $c )
|
foreach ( $tags as $c )
|
||||||
$out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . '</a>';
|
$out[] = "<a href='edit.php?post_type={$post->post_type}&tag={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . '</a>';
|
||||||
echo join( ', ', $out );
|
echo join( ', ', $out );
|
||||||
} else {
|
} else {
|
||||||
_e('No Tags');
|
_e('No Tags');
|
||||||
|
|
Loading…
Reference in New Issue