#3179 closed defect (bug) (fixed)
warning in category template function
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.0.6 | Priority: | normal |
Severity: | major | Version: | 2.0.4 |
Component: | Template | Keywords: | has-patch |
Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (6)
#2
@
18 years ago
- Keywords has-patch added
- Milestone set to 2.0.5
Patch for 2.0.x based on the code provided by Denis-de-Bernardy.
template-functions-category.php no longer exists in trunk and a quick search didn't give me that code in another file, so I'm assuming this is a 2.0 only issue.
Note: See
TracTickets for help on using
tickets.
Hi Denis-de-Bernardy,
Thank you!
If you have a fix please attach it as a patch -- even when it is trivial, it helps.
Also, if you can explicitly identify whether you have tested on trunk or not that is also very helpful.