Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#41924 closed enhancement (fixed)

get_{$adjacent}_post_sort filter should have $order parameter

Reported by: manchumahara Owned by: SergeyBiryukov
Priority: normal Milestone: 4.9
Component: Posts, Post Types Version:
Severity: normal Keywords: good-first-bug needs-refresh
Cc: Focuses:

Description

get_{$adjacent}_post_sort code looks like below

$sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post );

I think it should have the $order as parameter after $post, my proposed code is

$sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order );

as $order is missing as filter parameter it's not possible to understand what's the current $order from the the first parameter "ORDER BY p.post_date $order LIMIT 1"

Attachments (2)

patch.diff (1.1 KB ) - added by manchumahara 9 years ago.
added a patch for the changes need
41924.2.diff (1.2 KB ) - added by manchumahara 9 years ago.
2nd patch, added the @since tag

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
9 years ago

  • Component GeneralPosts, Post Types
  • Keywords needs-patch good-first-bug added
  • Milestone Awaiting ReviewFuture Release

@manchumahara
9 years ago

added a patch for the changes need

#2 follow-up: @Soean
9 years ago

  • Keywords needs-refresh added; needs-patch removed

Hallo @manchumahara
thanks for your patch. You also have to add the @since tag in the filter comment.

#3 in reply to: ↑ 2 @manchumahara
9 years ago

Hi,

What should be the version number in the since tag or How I can know what will be the next version in which this patch will be merged. Sorry for my ignorance. Can you please suggest me the ?

Replying to Soean:

Hallo @manchumahara
thanks for your patch. You also have to add the @since tag in the filter comment.

#4 @Soean
9 years ago

Hey,
you can use the next major version in your patch, 4.9.0. If the patch gets merged later, the core committer can change it very easily to the correct version.

@manchumahara
9 years ago

2nd patch, added the @since tag

#5 @SergeyBiryukov
9 years ago

  • Owner set to SergeyBiryukov
  • Status newreviewing

#6 @SergeyBiryukov
9 years ago

  • Milestone Future Release4.9

#7 @SergeyBiryukov
9 years ago

  • Resolutionfixed
  • Status reviewingclosed

In 41589:

Posts, Post Types: Pass the order parameter to get_{$adjacent}_post_sort filter.

Props manchumahara.
Fixes #41924.

Note: See TracTickets for help on using tickets.