Make WordPress Core

Opened 7 years ago

Last modified 6 years ago

#41843 new enhancement

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

Reported by: danburzo's profile danburzo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Query Keywords:
Focuses: Cc:

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
7 years ago

The hook is defined here: tags/4.8.1/src/wp-includes/link-template.php#L1716
(I do realize I need to tap into get_{$adjacent}_post_join as well)

Last edited 7 years ago by danburzo (previous) (diff)

#2 @joyously
6 years ago

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