Compatibility for multiple words search
-
When you search multiple words, WP will split each word in separate “Like” query, which essentially breaks the plugin regex in “posts_where”.
Here is a snippet that can be added to fix it, replacing line 72:
$search_vars = explode(' ', $wp->query_vars['s']); foreach ($search_vars as $search_var) { $where = preg_replace( "/($wpdb->posts.post_title LIKE '%{$search_var}%')/i", "$0 OR $wpdb->postmeta.meta_value LIKE '%{$search_var}%' ", $where ); }
- The topic ‘Compatibility for multiple words search’ is closed to new replies.