Deprecate is_term, is_taxonomy, is_post_type for *_exists(). Props nacin. fixes #13747

git-svn-id: https://develop.svn.wordpress.org/trunk@15220 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2010-06-11 15:53:41 +00:00
parent 9c74b84590
commit fc2793bd46
9 changed files with 94 additions and 40 deletions
+2 -2
View File
@@ -237,7 +237,7 @@ function _wp_ajax_add_hierarchical_term() {
$category_nicename = sanitize_title($cat_name);
if ( '' === $category_nicename )
continue;
if ( !($cat_id = is_term($cat_name, $taxonomy->name, $parent)) ) {
if ( !($cat_id = term_exists($cat_name, $taxonomy->name, $parent)) ) {
$new_term = wp_insert_term($cat_name, $taxonomy->name, array('parent' => $parent));
$cat_id = $new_term['term_id'];
}
@@ -501,7 +501,7 @@ case 'add-link-category' : // On the Fly
$slug = sanitize_title($cat_name);
if ( '' === $slug )
continue;
if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) {
if ( !$cat_id = term_exists( $cat_name, 'link_category' ) ) {
$cat_id = wp_insert_term( $cat_name, 'link_category' );
}
$cat_id = $cat_id['term_id'];
+1 -1
View File
@@ -14,7 +14,7 @@ wp_reset_vars( array('action', 'tag', 'taxonomy', 'post_type') );
if ( empty($taxonomy) )
$taxonomy = 'post_tag';
if ( !is_taxonomy($taxonomy) )
if ( !taxonomy_exists($taxonomy) )
wp_die(__('Invalid taxonomy'));
$tax = get_taxonomy($taxonomy);
+2 -2
View File
@@ -279,7 +279,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
}
if ( 'get-post-item' == $type ) {
if ( get_post_type_object( $object_type ) ) {
if ( post_type_exists( $object_type ) ) {
if ( isset( $request['ID'] ) ) {
$object_id = (int) $request['ID'];
if ( 'markup' == $response_format ) {
@@ -296,7 +296,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
echo "\n";
}
}
} elseif ( is_taxonomy( $object_type ) ) {
} elseif ( taxonomy_exists( $object_type ) ) {
if ( isset( $request['ID'] ) ) {
$object_id = (int) $request['ID'];
if ( 'markup' == $response_format ) {
+3 -3
View File
@@ -19,7 +19,7 @@
* @return unknown
*/
function category_exists($cat_name, $parent = 0) {
$id = is_term($cat_name, 'category', $parent);
$id = term_exists($cat_name, 'category', $parent);
if ( is_array($id) )
$id = $id['term_id'];
return $id;
@@ -240,7 +240,7 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
* @return unknown
*/
function tag_exists($tag_name) {
return is_term($tag_name, 'post_tag');
return term_exists($tag_name, 'post_tag');
}
/**
@@ -264,7 +264,7 @@ function wp_create_tag($tag_name) {
* @return unknown
*/
function wp_create_term($tag_name, $taxonomy = 'post_tag') {
if ( $id = is_term($tag_name, $taxonomy) )
if ( $id = term_exists($tag_name, $taxonomy) )
return $id;
return wp_insert_term($tag_name, $taxonomy);