Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Created January 27, 2026 20:31
Show Gist options
  • Select an option

  • Save propertyhive/0fefea73fbccc83018ecdaba19ae45f2 to your computer and use it in GitHub Desktop.

Select an option

Save propertyhive/0fefea73fbccc83018ecdaba19ae45f2 to your computer and use it in GitHub Desktop.
// Adds a Query ID 'soldpropertyquery' that can be used in Loop Grid widget
add_action( 'elementor/query/soldpropertyquery', 'elementor_query_sold_only' );
function elementor_query_sold_only( $query ) {
// Ensure we only query the 'properties' custom post type
$query->set( 'post_type', 'property' );
// Add tax query for Availability = Sold
$tax_query = array(
array(
'taxonomy' => 'availability',
'field' => 'slug',
'terms' => 'sold',
),
);
$query->set( 'tax_query', $tax_query );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment