WP Residence Help WP Residence Help

  • WpEstate
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / 28.Actions and filters / How to Modify Property Query Parameters Before Execution

How to Modify Property Query Parameters Before Execution

52 views 0

Filter: wpestate_query_2026_params

This is the most versatile filter in the Query 2026 pipeline. It fires after all
parameters have been normalized (sanitized, type-cast, and merged with context defaults), but
before any WP_Query arguments are built. At this point, you have access to the
complete, clean parameter array and can inject, remove, or modify any value the query engine understands.

Use this filter when you want to change what properties are queried at a high level —
for example, excluding specific property IDs, forcing a taxonomy filter, limiting price ranges,
or switching to “featured only” mode. The pipeline will then automatically build the correct
tax_query, meta_query, and other WP_Query arguments from the parameters
you provide.


When Does This Filter Fire?

This filter fires inside the main orchestrator function wpestate_query_2026_property(),
immediately after Step 2 (normalize and sanitize params) and before Step 3 (building the base
WP_Query args). At this point, all parameter values have been validated and cast to their correct
types (integers, floats, booleans, arrays, etc.).

Source file: libs/query/query2026/wpestate_query_2026_property.php


Filter Signature

$params = apply_filters( 'wpestate_query_2026_params', $params, $context, $options );

Parameters

Parameter Type Description
$params array The fully normalized parameter array. This is the value you must return from your
callback function. You can add, modify, or remove keys from this array.
$context string The query context: ‘directory’, ‘map’,
‘dashboard’, or ‘featured’. Use this to target specific
page types.
$options array The caller’s options array, provided for read-only reference. Contains flags like
respect_custom_order_zero. Modifying this array has no effect on the pipeline.

Available Parameter Keys

At the point where this filter fires, the $params array contains every recognized key,
already sanitized and cast to the correct type. Here is the complete list, grouped by category:

Pagination Parameters

Key Type Description
paged int Current page number (1-based).
posts_per_page int Number of properties per page. 0 = use WordPress site setting.
offset int Number of posts to skip (overrides paged math when set).
nopaging bool When true, returns all matching properties with no limit.
no_found_rows bool When true, skips counting total results (faster but no pagination).

Sort Order

Key Type Description
order int Numeric sort order code. 0 = featured-first (default), 1 = newest,
2 = price ascending, 3 = price descending, 4 = oldest,
5 = bedrooms ascending, 6 = bedrooms descending,
7 = size ascending, 8 = size descending.

Taxonomy Filters

Each taxonomy key accepts an array of term slugs, term names, or numeric term IDs. Non-Latin characters (Cyrillic, Arabic, Chinese, etc.) are fully supported.

Key Type WordPress Taxonomy
property_category array property_category (e.g. apartment, villa, office)
property_action_category array property_action_category (e.g. for-sale, for-rent)
property_city array property_city
property_area array property_area (neighborhoods within cities)
property_county_state array property_county_state
property_status array property_status (e.g. active, sold)
property_features array property_features (e.g. pool, garage, garden)
tax_relation string ‘AND’ or ‘OR’ — how multiple taxonomy clauses combine.

Numeric Range Filters

Key Type Description
price_min / price_max float Property price range.
beds_min / beds_max float Number of bedrooms range.
baths_min / baths_max float Number of bathrooms range.
rooms_min / rooms_max float Number of rooms range.
size_min / size_max float Property size range (in your theme’s unit: sqft or sqm).
lot_size_min / lot_size_max float Lot size range.

Text and Location Filters

Key Type Description
keyword string Keyword search (searches in property titles).
s string Alias for keyword.
country string Country filter (LIKE match on property_country meta).
location string Combined location search (searches across city, area, and county/state taxonomies).

Identity and Targeting

Key Type Description
p int Query a single property by its post ID.
post__in array Only include properties with these post IDs.
post__not_in array Exclude properties with these post IDs.
author int Filter by a single author’s user ID.
author__in array Filter by multiple author user IDs (include).
author__not_in array Exclude properties by these author user IDs.
agent int Filter by the assigned agent’s user ID.

Flags

Key Type Description
featured_only bool When true, only return properties marked as featured.
post_status string WordPress post status to query (default: ‘publish’).

Geolocation

Key Type Description
geo_lat float Center latitude for radius search.
geo_long float Center longitude for radius search.
geo_rad float Search radius (in the unit set in theme options: miles or km).

Meta and Custom Fields

Key Type Description
custom_fields array Key-value map of custom field slugs and their filter values (e.g. array(‘garage_spaces’ => ‘2’)).
custom_fields_compare array Key-value map of custom field slugs and comparison modes: ‘equal’, ‘greater’, ‘smaller’, ‘like’.
meta_query array Raw WP_Query meta_query clauses to pass through directly.
meta_relation string ‘AND’ or ‘OR’ — how multiple meta clauses combine.

Child Theme Examples

Example 1: Exclude Specific Properties From All Queries

If you have certain properties that should never appear in any listing, map, or widget on your site
(for example, test listings or internal placeholders), you can exclude them by their post IDs:

<?php
/**
 * Always exclude property IDs 101 and 102 from all property queries site-wide.
 *
 * This merges with any existing exclusions so it does not overwrite
 * exclusions set by other parts of the theme or other plugins.
 *
 * Add this code to your child theme's functions.php file.
 */
add_filter( 'wpestate_query_2026_params', 'my_child_exclude_properties', 10, 3 );
function my_child_exclude_properties( $params, $context, $options ) {
    // Get any existing exclusions to avoid overwriting them.
    $existing = isset( $params['post__not_in'] ) ? (array) $params['post__not_in'] : array();

    // Add our IDs to the exclusion list.
    $params['post__not_in'] = array_merge( $existing, array( 101, 102 ) );

    return $params;
}

Example 2: Force Directory Pages to Only Show “For Sale” Properties

If your site should only display properties with the “for-sale” action category on directory
(listing) pages, regardless of what the visitor selects in the search form:

<?php
/**
 * Force all directory listing pages to only show "for-sale" properties.
 *
 * This overwrites any action category filter the visitor may have selected.
 * Map, dashboard, and featured widget queries are not affected.
 *
 * Add this code to your child theme's functions.php file.
 */
add_filter( 'wpestate_query_2026_params', 'my_child_force_sale_only', 10, 3 );
function my_child_force_sale_only( $params, $context, $options ) {
    if ( 'directory' === $context ) {
        $params['property_action_category'] = array( 'for-sale' );
    }
    return $params;
}

Example 3: Show Only Featured Properties on the Map

If you want the property map to only display pins for featured listings (properties marked as
featured in the admin), you can enable the featured_only flag for the map context:

<?php
/**
 * Only show featured property pins on the map.
 * Non-featured properties will still appear on listing pages and other contexts.
 *
 * Add this code to your child theme's functions.php file.
 */
add_filter( 'wpestate_query_2026_params', 'my_child_map_featured_only', 10, 3 );
function my_child_map_featured_only( $params, $context, $options ) {
    if ( 'map' === $context ) {
        $params['featured_only'] = true;
    }
    return $params;
}

Example 4: Set a Minimum Price on Dashboard Listings

If you want the dashboard to only display properties that have a price of at least 50,000
(for example, to hide placeholder or zero-price listings from agents):

<?php
/**
 * Only show properties with a price of 50,000 or higher on the dashboard.
 * This helps agents focus on active, properly-priced listings.
 *
 * Add this code to your child theme's functions.php file.
 */
add_filter( 'wpestate_query_2026_params', 'my_child_dashboard_price_floor', 10, 3 );
function my_child_dashboard_price_floor( $params, $context, $options ) {
    if ( 'dashboard' === $context ) {
        $params['price_min'] = 50000;
    }
    return $params;
}

Example 5: Limit Results to 3 for Testing

During development, you may want to temporarily limit all property queries to return only
3 results so you can quickly test layouts and pagination:

<?php
/**
 * Temporary: limit all property queries to 3 results for layout testing.
 * Remove this filter when you are done testing.
 *
 * Add this code to your child theme's functions.php file.
 */
add_filter( 'wpestate_query_2026_params', 'my_child_debug_limit', 10, 3 );
function my_child_debug_limit( $params, $context, $options ) {
    $params['posts_per_page'] = 3;
    return $params;
}

Important Notes

  • This filter has the highest priority. Values you set here override anything that
    came from context defaults, page meta settings, or search form submissions. This is the right
    place to force values that must not be overridden.
  • Taxonomy values must be arrays. When setting taxonomy parameters like
    property_city or property_category, always use an array, even for a
    single value: array( 'new-york' ), not 'new-york'.
  • The pipeline builds WP_Query arguments from these params automatically. You do
    not need to build tax_query or meta_query arrays yourself when using
    this filter. Just set the named parameter (e.g. property_city,
    price_min) and the pipeline will build the correct WP_Query clauses.
  • For WP_Query-level arguments not covered by params (such as
    date_query, comment_count, or post_parent), use the
    wpestate_query_2026_args filter instead. That filter gives you direct access to
    the raw WP_Query arguments array.
28.Actions and filters

Related Articles

  • How to Add Custom Field Filters to Property Queries
  • How to Map Custom Search Form Fields to Query Parameters
  • How to Inspect or Replace Query Results After Execution
  • How to Modify the Final WP_Query Arguments

WP Residence Documentation

  • 01. Getting Started
    • How to Get Support
    • Get your buyer license code.
    • Use SSL / https
    • Server / Theme Requirements
  • 02. Installation & Setup
  • 03. Installation FAQ
  • 06. Search & Filtering
    • Advanced Search Display Settings
    • Advanced Search Form
    • Geolocation Search for Half Map
    • Save Search Theme Options
    • Advanced Search Colors
  • 09. Agent, Agency & Developers
  • 08. Property Pages & Layouts
  • 07. Property Lists, Categories & Archive
  • 13. WPResidence Elementor Studio
  • 10. Blog Posts & Blog List
  • 11. Shortcodes
    • Contact Form
    • Featured Agency/Developer
    • Membership Packages
    • Testimonials
    • Google Map with Property Marker
    • Listings per Agent, Agency or Developer
    • Display Categories
    • Agent List
    • Recent Items Slider
    • Recent items
    • List Properties or Articles by ID
    • Featured Agent
    • Featured Article
    • Featured Property
    • Login & Register Form
    • Icon Content Box Shortcode
  • 12. Widgets
  • 04. Theme Options & Global Settings
    • General Settings
    • User Types Settings
    • Appearance
    • Logos & Favicon
    • Header
    • Footer Style and Colors
    • Price & Currency
    • Property Custom Fields
    • Features & Amenities
    • Listing Labels
    • Theme Slider
    • Permalinks
    • Splash Page
    • Social & Contact
    • Map Settings
    • Pin Management
    • How read from file works
    • General Design Settings
    • Custom Colors Settings
    • Header Design & Colors
    • Mobile Menu Colors
    • User Dashboard Colors
    • Print PDF Design
    • Property, Agent, Blog Lists Design Settings
    • Sidebar Widget Design
    • Font management
    • How to add custom CSS
    • Custom Property Card Unit – Beta version
    • Email Management
    • Import & Export theme options
    • reCaptcha settings
    • YELP API Integration
    • iHomefinder Optima Express IDX
    • MEMBERSHIP & PAYMENT Settings
    • Property Submission Page
    • PayPal Setup
    • Stripe Setup
    • Wire Transfer Payment Method
  • 20. Translations & Languages
  • 26. FAQ
  • 10. Pages
  • 11. Header
  • 12. Footer
  • 05. Maps & Location Settings
  • 18. Payments & Monetization
  • Plugins
    • 19. Included Plugins
    • 22. Third Party Plugins – IDX Compatibility
    • 21. Third-Party Plugins – Multi-Language
    • 23. Third party Plugins – Other
  • Technical
    • 24. Technical how to | Custom Code Required
    • 25. Technical: Child Theme

Join Us On

Powered by WP Estate - All Rights Reserved
  • WpEstate
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API