Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#41924 closed enhancement (fixed)

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

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

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 7 years ago.
added a patch for the changes need
41924.2.diff (1.2 KB) - added by manchumahara 7 years ago.
2nd patch, added the @since tag

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
7 years ago

  • Component changed from General to Posts, Post Types
  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to Future Release

@manchumahara
7 years ago

added a patch for the changes need

#2 follow-up: @Soean
7 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
7 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
7 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
7 years ago

2nd patch, added the @since tag

#5 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#6 @SergeyBiryukov
7 years ago

  • Milestone changed from Future Release to 4.9

#7 @SergeyBiryukov
7 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

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.