infinite_scroll_posts_where

Filter Infinite Scroll's SQL date query making sure post queries will always return results prior to (descending sort) or before (ascending sort) the last post date.

Description

apply_filters( 'infinite_scroll_posts_where', (string) $clause, (object) $query, (string) $operator, (string) $last_post_date ); 

Parameters (4)

0. $clause (string)
SQL Date query.
1. $query (object)
The query.
2. $operator (string)
Query operator.
3. $last_post_date (string)
Last Post Date timestamp.

Usage

To run the hook, copy the example below.
  1. $clause = apply_filters( 'infinite_scroll_posts_where', $clause, $query, $operator, $last_post_date ); 
  2.  
  3. if ( !empty( $clause ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the infinite_scroll_posts_where callback 
  2. function filter_infinite_scroll_posts_where( $clause, $query, $operator, $last_post_date ) { 
  3. // make filter magic happen here... 
  4. return $clause
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'infinite_scroll_posts_where', 'filter_infinite_scroll_posts_where', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'infinite_scroll_posts_where', 'filter_infinite_scroll_posts_where', 10, 4 ); 

Defined (1)

The filter is defined in the following location(s).

/modules/infinite-scroll/infinity.php  
  1. $where .= apply_filters( 'infinite_scroll_posts_where', $clause, $query, $operator, $last_post_date );