Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Created November 28, 2022 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save propertyhive/e89abc8c63339294e4a94b31d518575c to your computer and use it in GitHub Desktop.
Save propertyhive/e89abc8c63339294e4a94b31d518575c to your computer and use it in GitHub Desktop.
add_filter( 'propertyhive_property_query_meta_query', 'exclude_completed_more_than_six_months', 10, 2 );
function exclude_completed_more_than_six_months($meta_querys, $q)
{
$meta_querys[] = array(
'relation' => 'OR',
array(
'key' => '_completion_date',
'compare' => 'NOT EXISTS'
),
array(
'key' => '_completion_date',
'value' => '',
'compare' => '='
),
array(
'key' => '_completion_date',
'value' => date("Y-m-d", strtotime('6 months ago')),
'compare' => '>='
)
);
return $meta_querys;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment