Opened 15 years ago
Closed 15 years ago
#12421 closed defect (bug) (fixed)
wp_list_bookmarks fails when orderby parameter is a comma separated list.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 2.9.1 |
Component: | Template | Keywords: | has-patch |
Focuses: | Cc: |
Description
wp_list_bookmarks returns nothing when the orderby parameter is a comma separated list.
This works:
wp_list_bookmarks('categorize=0&category_name=Blogroll&orderby=rating');
This fails (no output):
wp_list_bookmarks('categorize=0&category_name=Blogroll&orderby=rating,name');
This works:
wp_list_bookmarks('categorize=0&category_name=Blogroll&orderby=rating,link_name');
The problem lies in this block of code from wp-includes/bookmark.php, line 231:
switch ($orderby) { case 'length': $length = ", CHAR_LENGTH(link_name) AS length"; break; case 'rand': $orderby = 'rand()'; break; default: $orderby = "link_" . $orderby; } }} The prefix "link_" is added to the $orderby string, causing only the first name in the list to be correct.
Attachments (2)
Change History (8)
#1
@
15 years ago
- Milestone changed from Unassigned to Future Release
- Type changed from defect (bug) to enhancement
#2
@
15 years ago
From the Codex:Template_Tags/wp_list_bookmarks
orderby
(string) Value to sort bookmarks on. This can be a COMMA separated list of values. Defaults to 'name' unless you pass the value of (empty), in which case it sets to 'id'. Valid options:
#3
@
15 years ago
- Component changed from General to Template
- Keywords needs-patch added
- Milestone changed from Future Release to 3.0
- Type changed from enhancement to defect (bug)
My bad.
#4
@
15 years ago
- Keywords has-patch added; needs-patch removed
- Owner set to sorich87
- Status changed from new to accepted
This is my first patch here. I was not sure how to name the temporary variables.
Note: See
TracTickets for help on using
tickets.
Marking as enhancement, since the docs don't state that you can pass a comma separated list of values.