WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 8 months ago

#41843 new enhancement

Provide more flexibility to the `get_{$adjacent}_post_where` hook

Reported by: danburzo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Query Keywords:
Focuses: Cc:
PR Number:

Description

I'm working on getting the previous/next post for a Custom Post Type based on a certain postmeta value, and the get_{$adjacent}_post_where seems the appropriate hook for this. However, it currently receives the whole WHERE clause as a parameter. IMO it would be ideal to be able to override just the WHERE p.post_date $op %s AND p.post_type = %s part and keep the other (useful ones) intact.

This could potentially be solved in a non-breaking way by sending $where as it stands before concatenation with WHERE p.post_date $op %s AND p.post_type = %s, so that authors can neatly plugin a postmeta condition.

Change History (2)

#1 @danburzo
2 years ago

Version 0, edited 2 years ago by danburzo (next)

#2 @joyously
8 months ago

  • Component changed from Themes to Query
Note: See TracTickets for help on using tickets.