Opened 5 years ago
Closed 4 years ago
#7507 closed defect (bug) (fixed)
'wp_list_bookmarks()' and 'category_name' with non-existent category
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | lowest | Milestone: | 2.8 |
| Component: | Template | Version: | 2.6 |
| Severity: | trivial | Keywords: | has-patch tested |
| Cc: |
Description
When using 'wp_list_bookmarks()', if you specify a non-existent category with the 'category_name' parameter it shows all bookmarks from all categories. Should just return nothing, shouldn't it?
Attachments (2)
Change History (13)
comment:2
Denis-de-Bernardy
— 4 years ago
- Milestone set to Future Release
- Priority changed from normal to lowest
- Severity changed from normal to trivial
comment:3
Denis-de-Bernardy
— 4 years ago
- Component changed from General to Template
- Keywords needs-patch added; wp_list_bookmarks category_name removed
comment:4
Denis-de-Bernardy
— 4 years ago
confirmed in 2.8. the issue is in get_bookmarks().
if category name is not empty and it returns no terms, it should:
- cache an empty result
- return
comment:5
Denis-de-Bernardy
— 4 years ago
See also #9059
Viper007Bond
— 4 years ago
comment:6
Viper007Bond
— 4 years ago
- Keywords has-patch needs-testing added; needs-patch removed
- Milestone changed from Future Release to 2.8
comment:7
Denis-de-Bernardy
— 4 years ago
patch works, but it would be better located here:
http://core.trac.wordpress.org/browser/trunk/wp-includes/bookmark.php#L188
comment:8
Denis-de-Bernardy
— 4 years ago
the point would be to not get the term twice. It's negligible optimization, if any optimization at all, but you never know when the cache decides to fail for some reason... :P
comment:9
Viper007Bond
— 4 years ago
get_term_by() doesn't cache, so yes it'd be best to only do it once. Good catch.
comment:10
Denis-de-Bernardy
— 4 years ago
- Keywords tested added; needs-testing removed
comment:11
ryan
— 4 years ago
- Resolution set to fixed
- Status changed from new to closed
Bah, I forgot to mention that categorize also has to be set to 0.
Example:
wp_list_bookmarks('categorize=0&category_name=IDontExist');