Make WordPress Core

Changeset 14569


Ignore:
Timestamp:
05/11/2010 06:55:12 PM (14 years ago)
Author:
ryan
Message:

Don't wp_count_terms(). Just count the results returned from get_terms(), which has to run anyway. see #12734

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/nav-menu.php

    r14568 r14569  
    662662function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
    663663    $taxonomy_name = $taxonomy['args']->name;
    664     if ( ! $term_count = wp_count_terms( $taxonomy_name ) ) {
    665         echo '<p>' . __( 'No items.' ) . '</p>';
    666         return;
    667     }
     664   
    668665    // paginate browsing for large numbers of objects
    669666    $per_page = 50;
     
    685682    );
    686683
    687     $num_pages = ceil( $term_count / $per_page );
     684    $terms = get_terms( $taxonomy_name, $args );
     685
     686    if ( ! $terms || is_wp_error($terms) ) {
     687        echo '<p>' . __( 'No items.' ) . '</p>';
     688        return;
     689    }
     690
     691    $num_pages = ceil( count($terms) / $per_page );
    688692
    689693    $page_links = paginate_links( array(
     
    702706
    703707    $walker = new Walker_Nav_Menu_Checklist;
    704     // @todo transient caching of these results with proper invalidation on updating of a tax of this type
    705     $terms = get_terms( $taxonomy_name, $args );
    706 
    707     if ( ! $terms || is_wp_error($terms) )
    708         $error = '<li id="error">'. sprintf( __( 'No %s exists' ), $taxonomy['args']->label ) .'</li>';
    709708
    710709    $current_tab = 'most-used';
Note: See TracChangeset for help on using the changeset viewer.