#2652 closed defect (bug) (invalid)
category_exists() checks using slug
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | lowest | Milestone: | |
| Component: | Administration | Version: | 2.0.2 |
| Severity: | trivial | Keywords: | |
| Cc: |
Description
Okay, maybe I'm missing something, but I noticed when you give category_exists() a category name, it creates a sanitized version of that name (i.e. what it's slug would be) and then sees if there are any categories that already have that slug. However, you can change the slugs for categories in the admin area to something completely different than the category name.
Now is category_exists() really just used to see if a category slug exists? Or is it just checking in a bad method?
Change History (4)
comment:1
Viper007Bond — 7 years ago
- Priority changed from normal to lowest
- Severity changed from normal to trivial
comment:2
Viper007Bond — 7 years ago
I really need an edit button and to not submit tickets so late at night. :|
What I meant in my original ticket post:
"Now is category_exists() really just used to see if a category slug exists (so no slug collisions occur)? Or is it just checking via what appears to be a bad method?
comment:3
Viper007Bond — 7 years ago
- Resolution set to invalid
- Status changed from new to closed
Er, I'm an idiot. wp-hackers is the place for this kinda thing. I'll start a discussion on this there.
Sorry.

Er, meant to hit preview rather than submit.
Anyway, if it is just used to check for slug collisions, shouldn't this be called like "category_slug_exists()" or something? I was going to use this function for a script I'm writing that manually creates posts and any needed categories, but I want to check my category name, not the slug (I'm currently manually querying).