More custom taxonomy support for edit-tags.php

git-svn-id: http://svn.automattic.com/wordpress/trunk@10555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-02-12 00:00:01 +00:00
parent 57c3eba439
commit 556a4b2a05
2 changed files with 16 additions and 4 deletions

View File

@ -212,11 +212,16 @@ case 'delete-tag' :
if ( !current_user_can( 'manage_categories' ) )
die('-1');
$tag = get_term( $id, 'post_tag' );
if ( !empty($_POST['taxonomy']) )
$taxonomy = $_POST['taxonomy'];
else
$taxonomy = 'post_tag';
$tag = get_term( $id, $taxonomy );
if ( !$tag || is_wp_error( $tag ) )
die('1');
if ( wp_delete_term($id, 'post_tag'))
if ( wp_delete_term($id, $taxonomy))
die('1');
else
die('0');
@ -511,7 +516,12 @@ case 'add-tag' : // From Manage->Tags
$x->send();
}
$tag = wp_insert_term($_POST['name'], 'post_tag', $_POST );
if ( !empty($_POST['taxonomy']) )
$taxonomy = $_POST['taxonomy'];
else
$taxonomy = 'post_tag';
$tag = wp_insert_term($_POST['name'], $taxonomy, $_POST );
if ( is_wp_error($tag) ) {
$x = new WP_Ajax_Response( array(
@ -521,7 +531,7 @@ case 'add-tag' : // From Manage->Tags
$x->send();
}
if ( !$tag || (!$tag = get_term( $tag['term_id'], 'post_tag' )) )
if ( !$tag || (!$tag = get_term( $tag['term_id'], $taxonomy )) )
die('0');
$tag_full_name = $tag->name;

View File

@ -157,6 +157,7 @@ endif; ?>
<div id="col-right">
<div class="col-wrap">
<form id="posts-filter" action="" method="get">
<input type="hidden" name="taxonomy" value="<?php echo attribute_escape($taxonomy); ?>" />
<div class="tablenav">
<?php
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
@ -258,6 +259,7 @@ else
<div id="ajax-response"></div>
<form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list: validate">
<input type="hidden" name="action" value="addtag" />
<input type="hidden" name="taxonomy" value="<?php echo attribute_escape($taxonomy); ?>" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-tag'); ?>
<div class="form-field form-required">