Skip to content
Set the search result to be exact post You are here:
Home Snippet Set the search result to…
Set the search result to be exact post by
Leon , December 20, 2022
add_action( 'pre_get_posts','search_filter' );
function search_filter( $query ) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_search) {
$query->set( 'post_type', array( 'post' ) );
$query->set( 'sentence', 1 );
}
}
}
Go to Top
Marked Crafts
X
MASCO
X
Crafties
X
Warhawk Esports
X
Aldra
X
Physique
X
Quantic Online
X
Carnvalley
X We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Ok Reject Privacy policy