Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#3179 closed defect (bug) (fixed)

warning in category template function

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by:
Milestone: 2.0.6 Priority: normal
Severity: major Version: 2.0.4
Component: Template Keywords: has-patch
Focuses: Cc:


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);


Attachments (1)

3179.diff (474 bytes) - added by Nazgul 16 years ago.

Download all attachments as: .zip

Change History (6)

#1 @foolswisdom
16 years ago

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.

16 years ago

#2 @Nazgul
16 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.

#3 @markjaquith
16 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4280]) cast to array. props to Denis de Bernardy, Nazgul. fixes #3179

#4 @(none)
16 years ago

  • Milestone 2.0.5 deleted

Milestone 2.0.5 deleted

#5 @Denis-de-Bernardy
13 years ago

  • Milestone changed from Unassigned to 2.0.6
Note: See TracTickets for help on using tickets.