Changeset 10222 for trunk/wp-admin/includes/taxonomy.php
- Timestamp:
- 12/18/2008 07:12:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/taxonomy.php
r9481 r10222 195 195 * @return unknown 196 196 */ 197 function get_tags_to_edit( $post_id ) { 197 function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) { 198 return get_terms_to_edit( $post_id, $taxonomy); 199 } 200 201 /** 202 * {@internal Missing Short Description}} 203 * 204 * @since unknown 205 * 206 * @param unknown_type $post_id 207 * @return unknown 208 */ 209 function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) { 198 210 $post_id = (int) $post_id; 199 211 if ( !$post_id ) 200 212 return false; 201 213 202 $tags = wp_get_post_t ags($post_id);214 $tags = wp_get_post_terms($post_id, $taxonomy, array()); 203 215 204 216 if ( !$tags ) 205 217 return false; 206 218 219 if ( is_wp_error($tags) ) 220 return $tags; 221 207 222 foreach ( $tags as $tag ) 208 223 $tag_names[] = $tag->name; 209 224 $tags_to_edit = join( ',', $tag_names ); 210 225 $tags_to_edit = attribute_escape( $tags_to_edit ); 211 $tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit ); 226 $tags_to_edit = apply_filters( 'terms_to_edit', $tags_to_edit, $taxonomy ); 227 212 228 return $tags_to_edit; 213 229 } … … 234 250 */ 235 251 function wp_create_tag($tag_name) { 236 if ( $id = tag_exists($tag_name) ) 252 return wp_create_term( $tag_name, 'post_tag'); 253 } 254 255 /** 256 * {@internal Missing Short Description}} 257 * 258 * @since unknown 259 * 260 * @param unknown_type $tag_name 261 * @return unknown 262 */ 263 function wp_create_term($tag_name, $taxonomy = 'post_tag') { 264 if ( $id = is_term($tag_name, $taxonomy) ) 237 265 return $id; 238 266 239 return wp_insert_term($tag_name, 'post_tag'); 240 } 241 242 ?> 267 return wp_insert_term($tag_name, $taxonomy); 268 }
Note: See TracChangeset
for help on using the changeset viewer.