Forums Forums Search & Filter Pro sf_filter_query_args to hide option from dropdown

Viewing 3 posts - 1 through 3 (of 3 total)
  • Anonymous
    #188232

    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;
    }

    Trevor
    #188249

    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.

    Trevor
    #188251

    But, with regard to your question, I do not think it is possible, no.

Viewing 3 posts - 1 through 3 (of 3 total)