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

Support ignoring shortcodes #15

Closed Zodiac1978 closed 12 months ago

Zodiac1978 commented 12 months ago

Trying to do the same for shortcodes: $where .= " AND REGEXP_REPLACE({$wpdb->posts}.post_content, '\[.+?\]', '') LIKE '%{$search_query}%'";

But although it works in my regex test ... https://regex101.com/r/lbyiyL/1

... it does not work for the search.

Maybe @LinuxJedi can shed some light for me again :)

Zodiac1978 commented 12 months ago

Looks like I need to escape twice here: \\\\[.+?\\]

Found the solution via https://wpdirectory.net/search/01HBXK8M3TXZT5VTZSN2DVSGSW

LinuxJedi commented 12 months ago

Sorry, I am at the MariaDB Unconference this week so am slow to respond, it does look like an escaping issue. Please reach out to me if you require further advice and I can give it some attention when I'm back in the UK :)