]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/taxonomy.php
WordPress 4.2
[autoinstalls/wordpress.git] / wp-admin / includes / taxonomy.php
index a4fa571b55ea409d84d7d1ad27ebce3078a4a5f6..9529a2b24fa665831ce7879ecfe9e7c0430f3e64 100644 (file)
 //
 
 /**
- * {@internal Missing Short Description}}
+ * Check whether a category exists.
  *
  * @since 2.0.0
  *
- * @param int|string $cat_name
- * @return int
+ * @see term_exists()
+ *
+ * @param int|string $cat_name Category name.
+ * @param int        $parent   Optional. ID of parent term.
+ * @return mixed
  */
-function category_exists($cat_name, $parent = 0) {
+function category_exists( $cat_name, $parent = null ) {
        $id = term_exists($cat_name, 'category', $parent);
        if ( is_array($id) )
                $id = $id['term_id'];
@@ -26,7 +29,7 @@ function category_exists($cat_name, $parent = 0) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Get category object for given ID and 'edit' filter context.
  *
  * @since 2.0.0
  *
@@ -40,7 +43,7 @@ function get_category_to_edit( $id ) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Add a new category to the database if it does not already exist.
  *
  * @since 2.0.0
  *
@@ -66,12 +69,12 @@ function wp_create_category( $cat_name, $parent = 0 ) {
  */
 function wp_create_categories( $categories, $post_id = '' ) {
        $cat_ids = array ();
-       foreach ($categories as $category) {
-               if ($id = category_exists($category))
+       foreach ( $categories as $category ) {
+               if ( $id = category_exists( $category ) ) {
                        $cat_ids[] = $id;
-               else
-                       if ($id = wp_create_category($category))
-                               $cat_ids[] = $id;
+               } elseif ( $id = wp_create_category( $category ) ) {
+                       $cat_ids[] = $id;
+               }
        }
 
        if ( $post_id )
@@ -186,7 +189,7 @@ function wp_update_category($catarr) {
 //
 
 /**
- * {@internal Missing Short Description}}
+ * Check whether a post tag with a given name exists.
  *
  * @since 2.3.0
  *
@@ -198,7 +201,7 @@ function tag_exists($tag_name) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Add a new tag to the database if it does not already exist.
  *
  * @since 2.3.0
  *
@@ -210,11 +213,12 @@ function wp_create_tag($tag_name) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Get comma-separated list of tags available to edit.
  *
  * @since 2.3.0
  *
- * @param int $post_id
+ * @param int    $post_id
+ * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
  * @return string|bool|WP_Error
  */
 function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
@@ -222,11 +226,12 @@ function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Get comma-separated list of terms available to edit for the given post ID.
  *
  * @since 2.8.0
  *
- * @param int $post_id
+ * @param int    $post_id
+ * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
  * @return string|bool|WP_Error
  */
 function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
@@ -269,11 +274,12 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Add a new term to the database if it does not already exist.
  *
  * @since 2.8.0
  *
  * @param int|string $tag_name
+ * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
  * @return array|WP_Error
  */
 function wp_create_term($tag_name, $taxonomy = 'post_tag') {