Add_Custom_Fields_To_Search::cf_search_where( string $where )
cf_search_where
Contents
Description Description
Modify the search query with posts_where
See also See also
Parameters Parameters
- $where
-
(string) (Required)
Return Return
(void)
Source Source
File: includes/class-add-custom-fields-to-search.php
function cf_search_where( $where ) { if ( ! is_search() || $this->is_media_library() ) { return $where; } global $wpdb; $where = preg_replace( "/\(\s*$wpdb->posts.post_title\s+LIKE\s*(\'[^\']+\')\s*\)/", "($wpdb->posts.post_title LIKE $1) OR ( searchmeta.meta_value LIKE $1) OR (t.name LIKE $1) OR (t.slug LIKE $1)", $where ); return $where; }
Expand full source code Collapse full source code View on Github