To avoid the splitting of searchphrases, use the sentence
query variable in the pre_get_posts hook:
function only_search_for_full_phrase( $query ) {
if ( $query->is_search() && $query->is_main_query() ) {
$query->set( 'sentence', true );
}
}
add_action( 'pre_get_posts', 'only_search_for_full_phrase' );
Didn’t test it, but should do the trick.
Happy Coding!
Related Posts:
- How to hook update_post_meta and delete_post_meta?
- Are there any hooks that alter the 404 logic?
- Use wp init hook to call other hooks?
- Add_action to wp_head via functions.php
- Hook that fires when admin setting is saved
- What is the difference between update_post_meta and update_postmeta hooks?
- How to remove action hook done in a plugin from functions.php in my theme?
- Hooks for trashing, deleting, saving, restoring custom post type
- Implementing advanced add_* function wrappers
- Adding onload to body
- My add_action (wp_footer, ‘method’) is not calling?
- Hook into wp_head(); in a plugin
- Send data to 3rd party api with wp_remote_post on wp_login
- Use $query->set multiple times with pre_get_posts?
- How can I hook into the post editor title field in order to change the HTML?
- deactivated_plugin hook: get the name of the plugin
- WordPress v5.0.3 Gutenberg & JS error “Uncaught SyntaxError: missing ) after argument list”
- Setcookie works on admin but not front end
- Can’t get ID of post that relates to the comment
- Searching hook to set cookies before and avoid “headers already sent”
- Hook before inserting user into database [duplicate]
- WP Admin Bar frontend issue with dashicon deregister
- wp_redirect() not working on form submission with init hook
- add_action for lost_password or modify wp-login.php?action=lostpassword
- Firing a function AFTER redirect
- How can I customize the upload error message in WordPress?
- WooCommerce – Overwrite action hook [closed]
- Admin Hook at the Login Page
- Which Hook? Hide attachments from specific post types in media library
- Why is save_post hook being called twice despite all my efforts?
- Custom action on login and “remember me”
- How to hook into Add New Member in BuddyPress
- Using wp_editor tinyMCE in metabox cause form alert on leaving page
- TinyMCE as comment editor – encoding issues
- Hook to change Logout url
- Understanding WP
- Hook when new CPT published AND postmeta inserted
- Need to check is_archive during init
- When WP_CLI runs WordPress from the command line, are hooks called?
- Query categories that have a description
- Trying to run a compile command while saving post
- wp_insert_post_data hook should be called before updating db but isn’t
- Action hook for custom tax edit
- wp cron job fires at every second or so, if callback is wrapped with DOING_CRON check it never fires at all
- load-* hook for dashboard
- What conditions must be met in order to upload .zip file to a multisite WordPress installation?
- How to hook code in ?
- wp_enqueue_script before wp_head
- Is it possible to add the_content filter upon login?
- save_post hook to add terms getting deleted when using bulk edit
- Add Different Actions To Different Page’s wp_footer
- Use an array of page template slugs and $hook
- wp_logout hook never triggered
- add short description under price
- How do I use pre_option_{option_name} correctly?
- post.php AJAX request not being called when publishing post
- WordPress media library allow uploading fake file
- What hook do I use if I want to update a user profile field when a new user is created?
- How to add custom tab page in backend?
- Add html code in admin page
- Hooking dynamic/variable named hook in all cases
- What hook to add at start of WordPress load
- Knowing if a post is sticky in the ‘save_post’ action. Where do I have to hook?
- How to read and write session data?
- Count when a post of a custom post type is deleted and store it in a theme option
- Can we change the hook firing sequence?
- Intercept loading of a certain page
- Add content in cpt archive page
- Creating custom post on registration in wordpress?
- Display custom user profile fields in wordpress
- profile_update not supplying old data
- Output Redirect Headers on Admin Dashboard Page
- add_image_size not working with after_switch_theme
- wordpress hooks
- Check when a setting has been changed
- is_page not triggering
- add extra parameter in default hook in wordpress
- Exclude WooCommerce terminations from YOAST
- Hook triggered twice in a Woocommerce single product page
- set_post_format called after wp_update_post when using bulk edit?
- Object oriented programming, add_action in constructor not firing
- add hook restricted only to either plugins or themes?
- How to hook watchdog script for existence of a WP page?
- Get new (not old) post inside transition_post_status hook
- addaction hook cause redirection problem
- Remove “enqueued” script from array
- Getting all post/page IDs related to a soon-to-be-deleted tag/cat
- Hooking get_pages()
- Fire a hook programmatically
- Transform .wp-video to the native video player of the browser
- How do I override the user’s input when updating a custom post type’s permalink?
- How to add a new link to the default register form’s footer links?
- How to use the password_reset hook to validate new password and display error
- getSaveContent.extraProps hook for core/post-title doesn’t add new attributes on to the frontend
- Callback API for getting response from fygaro payment gateway
- Use wordpress search hooks to search a second database
- Why callback function is not working in wp_head hook?
- woocommerce_add_to_cart_validation max quantity depending on user geoip [closed]
- theme.json is altering Group block HTML
- Not able to set userId and email at wp_set_current_user in Worpdress