Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#7507 closed defect (bug) (fixed)

'wp_list_bookmarks()' and 'category_name' with non-existent category

Reported by: therks Owned by:
Priority: lowest Milestone: 2.8
Component: Template Version: 2.6
Severity: trivial Keywords: has-patch tested
Cc: Focuses:

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)

7507.patch​ (648 bytes ) - added by Viper007Bond 18 years ago.
7507.2.patch​ (721 bytes ) - added by Viper007Bond 18 years ago.
Avoid double get_term_by() call

Download all attachments as: .zip

Change History (13)

#1 @therks
18 years ago

Bah, I forgot to mention that categorize also has to be set to 0.
Example:

wp_list_bookmarks('categorize=0&category_name=IDontExist');

#2 @Denis-de-Bernardy
18 years ago

  • Milestone → Future Release
  • Priority normal → lowest
  • Severity normal → trivial

#3 @Denis-de-Bernardy
18 years ago

  • Component General → Template
  • Keywords needs-patch added; wp_list_bookmarks category_name removed

#4 @Denis-de-Bernardy
18 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:

  1. cache an empty result
  2. return

#6 @Viper007Bond
18 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Milestone Future Release → 2.8

#8 @Denis-de-Bernardy
18 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

#9 @Viper007Bond
18 years ago

get_term_by() doesn't cache, so yes it'd be best to only do it once. Good catch.

@Viper007Bond
18 years ago

Avoid double get_term_by() call

#10 @Denis-de-Bernardy
18 years ago

  • Keywords tested added; needs-testing removed

#11 @ryan
18 years ago

  • Resolution → fixed
  • Status new → closed

(In [11064]) Return empty list if requests bookmark category does not exist. Props Viper007Bond. fixes #7507

Note: See TracTickets for help on using tickets.