In the latest version, you can exclude properties by assigning them a specific status and then you can choose the property statuses to exclude them from search results, navigate to Dashboard → RealHomes → Customize Settings → Properties Search → Properties Search Page.
Old Version Support
If you are using a very old version then you can exclude a property status from search results by using the following code in your child theme’s functions.php file.
function inspiry_filter_search_results($search_args) { $status_to_exclude = array('sold'); if( isset( $search_args[ 'tax_query' ] ) ) : $search_args[ 'tax_query' ] = array_merge($search_args[ 'tax_query' ], array( array( 'taxonomy' => 'property-status', 'field' => 'slug', 'terms' => $status_to_exclude, 'operator' => 'NOT IN' ) )); else : $search_args[ 'tax_query' ] = array( array( 'taxonomy' => 'property-status', 'field' => 'slug', 'terms' => $status_to_exclude, 'operator' => 'NOT IN' ) ); endif; return $search_args; } add_filter('real_homes_search_parameters','inspiry_filter_search_results');
You just have to change the value of the variable called $status_to_exclude and put the slug of the property status you want to exclude from search results. For example, in the above code, We are modifying our search results to not display the properties with the status “sold“.
One more important thing to note is the correct slug. You can get the property status slugs by editing the Property Status as shown in the screenshot.
In the case of multiple statuses to be excluded you can put them by adding a comma to separate them. Please check the following code:
$status_to_exclude = array('rented', 'sold');
In the code above we are excluding the properties based on 2 different property statuses.
Hopefully, it will help.