Changeset 28561
- Timestamp:
- 05/23/2014 07:28:45 PM (11 years ago)
- Location:
- trunk/src/wp-admin/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/taxonomy.php
r28500 r28561 235 235 return false; 236 236 237 $tags = wp_get_post_terms($post_id, $taxonomy, array()); 238 239 if ( !$tags ) { 237 $terms = get_object_term_cache( $post_id, $taxonomy ); 238 if ( false === $terms ) { 239 $terms = wp_get_object_terms( $post_id, $taxonomy ); 240 wp_cache_add( $post_id, $terms, $taxonomy . '_relationships' ); 241 } 242 243 if ( ! $terms ) { 240 244 return false; 241 245 } 242 if ( is_wp_error( $tags) ) {243 return $t ags;244 } 245 $t ag_names = array();246 foreach ( $t ags as $tag) {247 $t ag_names[] = $tag->name;248 } 249 250 $t ags_to_edit = esc_attr( join( ',', $tag_names ) );246 if ( is_wp_error( $terms ) ) { 247 return $terms; 248 } 249 $term_names = array(); 250 foreach ( $terms as $term ) { 251 $term_names[] = $term->name; 252 } 253 254 $terms_to_edit = esc_attr( join( ',', $term_names ) ); 251 255 252 256 /** … … 257 261 * @see get_terms_to_edit() 258 262 * 259 * @param array $t ags_to_edit An array of terms.263 * @param array $terms_to_edit An array of terms. 260 264 * @param string $taxonomy The taxonomy for which to retrieve terms. Default 'post_tag'. 261 265 */ 262 $t ags_to_edit = apply_filters( 'terms_to_edit', $tags_to_edit, $taxonomy );263 264 return $t ags_to_edit;266 $terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy ); 267 268 return $terms_to_edit; 265 269 } 266 270 -
trunk/src/wp-admin/includes/template.php
r28514 r28561 365 365 366 366 if ( $taxonomy->hierarchical && $taxonomy->show_ui ) { 367 echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' 368 . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array( 'fields' => 'ids' ) ) ) . '</div>'; 367 368 $terms = get_object_term_cache( $post->ID, $taxonomy_name ); 369 if ( false === $terms ) { 370 $terms = wp_get_object_terms( $post->ID, $taxonomy_name ); 371 wp_cache_add( $post->ID, $terms, $taxonomy_name . '_relationships' ); 372 } 373 $term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' ); 374 375 echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>'; 376 369 377 } elseif ( $taxonomy->show_ui ) { 378 370 379 echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">' 371 380 . esc_html( str_replace( ',', ', ', get_terms_to_edit( $post->ID, $taxonomy_name ) ) ) . '</div>'; 381 372 382 } 373 383 }
Note: See TracChangeset
for help on using the changeset viewer.