• Resolved lemontreefruit

    (@lemontreefruit)


    Hi,

    I am trying to use

    By returning true or false you can turn search filtering respectively.

    Example: Let’s say you need to disable search filtering if searching by specific post_type. In this case you could add following code to you functions.php:

    add_filter(‘searchexclude_filter_search’, ‘filterForProducts’, 10, 2);
    function filterForProducts($exclude, $query)
    {
    return $exclude && ‘attachment‘ !== $query->get(‘post_type’);
    }

    I am not a programmer… it does not work somehow… how do I set to ‘true’?

    ??
    Lemontreefruit

    https://www.ads-software.com/plugins/search-exclude/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Setting post type to true in functions.php’ is closed to new replies.