wp_query search all function

[ad_1]

​

function the\_filter $where, $my\_query ) {

global $wpdb;

echo “searching only title”;

if ( $search\_term = $my\_query->get( ‘search\_post\_title’ )) {

$where .= ‘ AND ‘ . $wpdb->posts . ‘.post\_title LIKE \\’%’ ;

}

return $where;

}

​

would like to be able to force this function to search not only the post title for like terms but also the tags and the body and the slug. How do I amend the $where variable to search the tags and title and slug and body etc. Couldn’t find any code online of people using anything other than the title.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer