Category name handling wrong function is_category
|Reported by:||Azaroth||Owned by:|
|Component:||Query||Keywords:||dev-feedback has-patch needs-testing gsoc close|
When putting numbers in front of the category names, Wordpress uses them as basis for the function is_category which leads to problems with e.g. plugins using this function.
- 3 Categories: "News" (id 1), "1st Release" (id 2), "2nd Release" (id 3)
- Trying to check the category with is_category(1) works for news, but also returns true for the category "1st Release"
- Trying to check the category with is_category(2) returns true for both, "1st Release" and "2nd Release"
This behaviour is not expected. It might be interesting when you explicitely give the category numbers as names (e.g. "1", "2", "3"). Changing the in_array function to a simple equal comparison makes everything work as expected.
Change History (8)
- Component changed from General to Template
- Keywords needs-patch added
- Milestone set to 2.9
comment:6 wojtek.szkutnik — 4 years ago
- Cc wojtek.szkutnik@… added
- Keywords has-patch needs-testing gsoc added