[wp-trac] [WordPress Trac] #3179: warning in category template function

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 29 23:54:13 GMT 2006


#3179: warning in category template function
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:  anonymous
     Type:  defect             |      Status:  new      
 Priority:  normal             |   Milestone:           
Component:  Template           |     Version:  2.0.4    
 Severity:  major              |    Keywords:           
-------------------------------+--------------------------------------------
 Warning: Invalid argument supplied for foreach() in
 /home/dolelm/public_html/testblog/wp-includes/template-functions-
 category.php on line 321

 You can get this error when all categories are excluded using the
 available hook to drop categories.


 to fix, cast $categories on line 304 as an array, i.e.:

 {{{
                 $query = "
                         SELECT cat_ID, cat_name, category_nicename,
 category_description, category_parent, category_count
                         FROM $wpdb->categories
                         WHERE cat_ID > 0 $exclusions
                         ORDER BY $sort_column $sort_order";

                 $categories = (array) $wpdb->get_results($query);

 }}}

 D.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3179>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list