WordPress.org

Make WordPress Core

Changeset 7739


Ignore:
Timestamp:
04/18/2008 06:12:04 PM (10 years ago)
Author:
ryan
Message:

Don't query post cats if no post. see #2621

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r7737 r7739  
    242242<div id="categories-all" class="ui-tabs-panel">
    243243    <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
    244         <?php wp_category_checklist($post->ID) ?>
     244        <?php wp_category_checklist($post_ID) ?>
    245245    </ul>
    246246</div>
  • trunk/wp-admin/includes/template.php

    r7737 r7739  
    157157}
    158158
    159 function wp_category_checklist( $post_id ) {
     159function wp_category_checklist( $post_id = 0 ) {
    160160    $walker = new Walker_Category_Checklist;
    161161
    162162    $args = array();
    163     $args['selected_cats'] = wp_get_post_categories($post_id);
     163   
     164    if ( $post_id )
     165        $args['selected_cats'] = wp_get_post_categories($post_id);
     166    else
     167        $args['selected_cats'] = array();
    164168    $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10 ) );
    165169    $categories = get_categories('get=all');
Note: See TracChangeset for help on using the changeset viewer.