epl_is_front_end_listing_query: which queries leave out hidden listings
Description #
Decides which queries count as Easy Property Listings' own front end listing queries: the listing archives, search results, location, feature and business category pages, the EPL shortcodes, the EPL widgets, and Elementor Pro Loop Grids that use an EPL Loop Item. Withdrawn, off market and deleted listings are left out of these queries (see epl_hide_listing_statuses). Admin screens, single listings and other plugins' queries are not included.
Usage #
add_filter( 'epl_is_front_end_listing_query', 'my_function', 10, 2 );
Parameters #
$is (bool)
True for EPL archives, search, shortcodes and widgets.
$query (WP_Query)
The query.
Examples #
Also hide withdrawn and off market listings in your own listing query
add_filter( 'epl_is_front_end_listing_query', function ( $is, $query ) {
if ( $query->get( 'my_listing_query' ) ) {
return true;
}
return $is;
}, 10, 2 );
$listings = new WP_Query( array(
'post_type' => 'property',
'my_listing_query' => true,
) );
Source #
lib/includes/template-functions.php, in epl_is_front_end_listing_query(). Used by epl_exclude_hidden_listing_statuses() on pre_get_posts. The hidden listing IDs come from epl_get_hidden_listing_ids(), cached until a listing changes. Since 3.6.