Don't query post cats if no post. see #2621
git-svn-id: http://svn.automattic.com/wordpress/trunk@7739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3495bf80e0
commit
65e4ddc684
|
@ -241,7 +241,7 @@ endif; ?>
|
|||
|
||||
<div id="categories-all" class="ui-tabs-panel">
|
||||
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
|
||||
<?php wp_category_checklist($post->ID) ?>
|
||||
<?php wp_category_checklist($post_ID) ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -156,11 +156,15 @@ class Walker_Category_Checklist extends Walker {
|
|||
}
|
||||
}
|
||||
|
||||
function wp_category_checklist( $post_id ) {
|
||||
function wp_category_checklist( $post_id = 0 ) {
|
||||
$walker = new Walker_Category_Checklist;
|
||||
|
||||
$args = array();
|
||||
$args['selected_cats'] = wp_get_post_categories($post_id);
|
||||
|
||||
if ( $post_id )
|
||||
$args['selected_cats'] = wp_get_post_categories($post_id);
|
||||
else
|
||||
$args['selected_cats'] = array();
|
||||
$args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10 ) );
|
||||
$categories = get_categories('get=all');
|
||||
$args = array($categories, 0, $args);
|
||||
|
|
Loading…
Reference in New Issue