WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#18234 closed defect (bug) (fixed)

get_bookmarks not order by id

Reported by: psophy Owned by: ryan
Milestone: 3.2.2 Priority: normal
Severity: normal Version: 3.2.1
Component: General Keywords: has-patch
Focuses: Cc:

Description

When I use get_bookmarks() function to get links and I want to order by link id:

   $bookmarks = get_bookmarks(array(
        'orderby'        => 'id',
        'order'          => 'DESC',
         'category' => 6
   ));

But it not order by link id It still use link name to order and I see SQL result :

SELECT * FROM wp_links  INNER JOIN wp_term_relationships AS tr ON (wp_links.link_id = tr.object_id) 
INNER JOIN wp_term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id 
WHERE 1=1 AND link_visible = 'Y'  AND ( tt.term_id = 6 ) AND taxonomy = 'link_category' ORDER BY link_name DESC

Attachments (1)

18234.patch (628 bytes) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 ocean903 years ago

  • Component changed from Filesystem to General
  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Since WordPress 3.2 it's link_id, see r18345.

comment:2 nacin3 years ago

  • Milestone set to 3.2.2
  • Resolution worksforme deleted
  • Status changed from closed to reopened

Man, I missed that. "id" used to work. Alright.

SergeyBiryukov3 years ago

comment:3 follow-up: SergeyBiryukov3 years ago

  • Keywords has-patch added

comment:4 in reply to: ↑ 3 psophy3 years ago

Replying to SergeyBiryukov:
Thank you for your patch SergeyBiryukov!

comment:5 ryan3 years ago

In [18470]:

Allow sorting by id in get_bookmarks(). Props SergeyBiryukov. see #18234 for trunk

comment:6 ryan3 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from reopened to closed

In [18471]:

Allow sorting by id in get_bookmarks(). Props SergeyBiryukov. fixes #18234 for 3.2

Note: See TracTickets for help on using tickets.