Forums Forums Search & Filter Pro Exclude from SFP query in theme, not in CMS

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

    Hi there,

    I’m looking to dynamically exclude post’s by ID in a particular template.

    I have this code:

    `
    $args = [
    ‘search_filter_id’ => $sfpform->id(),
    ];

    $news = new WP_Query($args);
    `

    I have tried this below, but it doesn’t work. The post__not_in value is not picked up.

    `
    $args = [
    ‘search_filter_id’ => $sfpform->id(),
    ‘post__not_in’ => [‘1511’],
    ];

    $news = new WP_Query($args);
    `

    Is it possible to hook into the query after search and filter has been added, but before the query is run, so that I can add extra overrides?

    Cheers,
    Jamie

    Anonymous
    #274557

    Apologies, I found the filter in the filter reference section. Thanks, and this ticket can be closed.

    Trevor
    #274587

    Thanks for letting me know. I will close this thread for now.

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