wp_query_search_exclusion_prefix

wp_query_search_exclusion_prefix

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-6.7.2

apply_filters('wp_query_search_exclusion_prefix') is found 1 times:

  • /wp-includes/class-wp-query.php line 1460
    1456
    1457
    1458
    1459
    1460
    1461
    1462
    1463
    1464
    1465
    1466
    *
     * @param string $exclusion_prefix The prefix. Default '-'. Returning
     *                                 an empty value disables exclusions.
     */
    $exclusion_prefix = apply_filters( 'wp_query_search_exclusion_prefix', '-' );
     
    foreach ( $q['search_terms'] as $term ) {
        // If there is an $exclusion_prefix, terms prefixed with it should be excluded.
        $exclude = $exclusion_prefix && str_starts_with( $term, $exclusion_prefix );
        if ( $exclude ) {
            $like_op  = 'NOT LIKE';