- This topic has 2 replies, 2 voices, and was last updated 7 years, 6 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › sf_filter_query_args to hide option from dropdown
Tagged: search form UI, sf_filter_query_args
I’m using the code bellow to hide posts that are older than the current date. It’s working on the default results but it’s not working on the filter(dropdown).
Is there a way to exclude old posts from showing on the filter(Search Form UI) too?
Thanks
add_filter( ‘sf_edit_query_args’, ‘kp_exclude_old_post’, 100, 2 );
function kp_exclude_old_post( $query ) {
$time_ago = date(‘Y-m-d’, strtotime(‘-1 day’));
$query[‘meta_query’] = array(
array(
‘key’ => ‘acfDia’,
‘value’ => $time_ago,
‘compare’ => ‘>=’,
‘type’ => ‘DATE’
)
);
return $query;
}
Hi
Please note that, as your license appears to have expired, you will first need to renew the license to receive support.
If you have a license under a different account, you would need to log in to that account and add a private reply to this thread with that account so that I can tie the thread to that other account.