Zodiac1978 / wp-search-ignore-block-names

Modifies the native search to ignore block editor comments
https://wordpress.org/plugins/ignore-block-name-in-search/
GNU General Public License v2.0
4 stars 3 forks source link

Search for title and excerpt is broken with this plugin #16

Closed Zodiac1978 closed 1 year ago

Zodiac1978 commented 1 year ago

A simplified Query for a standard search is this

SELECT SQL_CALC_FOUND_ROWS wp_posts.ID 
FROM wp_posts WHERE 1=1 
AND (((wp_posts.post_title LIKE '%wat%') 
OR (wp_posts.post_excerpt LIKE '%wat%') 
OR (wp_posts.post_content LIKE '%wat%')))

This plugin adds a new condition:

$where .= " AND REGEXP_REPLACE({$wpdb->posts}.post_content, '<.+?>', '') LIKE '%{$search_query}%'";

This breaks searching for title and excerpt.

We need to add the two OR statements again to fix this.

Zodiac1978 commented 1 year ago

As an alternative, we need to change the third condition to our version of it.