Opened 9 years ago
Last modified 7 years ago
#41843 new enhancement
Provide more flexibility to the `get_{$adjacent}_post_where` hook
| Reported by: | danburzo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Query | Version: | 4.9 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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_joinas well)