From 0a0c6e2c1e4a0d20e282c3766635f1c749419edc Mon Sep 17 00:00:00 2001
From: Brian DiChiara <briandichiara@gmail.com>
Date: Fri, 5 Feb 2016 21:53:11 -0600
Subject: [PATCH] adds new filters inside get_adjacent_post() to override the
entire query or override the the result
---
wp-includes/link-template.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index ee02cd7..a26a4c6 100644
|
a
|
b
|
function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo |
| 1712 | 1712 | */ |
| 1713 | 1713 | $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post ); |
| 1714 | 1714 | |
| 1715 | | $query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort"; |
| | 1715 | $query = apply_filters( "get_{$adjacent}_post_query", "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort", $post ); |
| 1716 | 1716 | $query_key = 'adjacent_post_' . md5( $query ); |
| 1717 | 1717 | $result = wp_cache_get( $query_key, 'counts' ); |
| 1718 | 1718 | if ( false !== $result ) { |
| … |
… |
function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo |
| 1721 | 1721 | return $result; |
| 1722 | 1722 | } |
| 1723 | 1723 | |
| 1724 | | $result = $wpdb->get_var( $query ); |
| | 1724 | $result = apply_filters( "get_{$adjacent}_post_result", $wpdb->get_var( $query ), $post ); |
| 1725 | 1725 | if ( null === $result ) |
| 1726 | 1726 | $result = ''; |
| 1727 | 1727 | |