[wp-trac] [WordPress Trac] #12421: wp_list_bookmarks fails when orderby parameter is a comma separated list.

WordPress Trac wp-trac at lists.automattic.com
Sun Feb 28 00:28:49 UTC 2010


#12421: wp_list_bookmarks fails when orderby parameter is a comma separated list.
--------------------------+-------------------------------------------------
 Reporter:  vtxyzzy       |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:  2.9.1     
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12421>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list