Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Created October 22, 2025 05:47
Show Gist options
  • Save propertyhive/e601dbd9b6b43d884a5167603ba139a7 to your computer and use it in GitHub Desktop.
Save propertyhive/e601dbd9b6b43d884a5167603ba139a7 to your computer and use it in GitHub Desktop.
add_action( 'elementor/query/onmarketpropertyquery', 'handle_sold_tickbox' );
function handle_sold_tickbox($query)
{
$tax_query = $q->get('tax_query');
if ( !isset($_GET['include_sold_stc']) )
{
// Not ticked. Only include available properties
if (!is_array($tax_query)) { $tax_query = array(); }
$tax_query[] = array(
'taxonomy' => 'availability',
'field' => 'term_id',
'terms' => array(20, 24), // 20 = For sale, 24 = To Let
'operator' => 'IN'
);
}
$query->set( 'tax_query', $tax_query );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment