In my plugin code I would like to perform a
Passing a query variable of "s" to
WP_Query with a search term will filter post results by search term:
$query_args = array( 's' => 'disquiet' ); $query = new WP_Query( $query_args );
The corresponding SQL
WHERE clause generated by this query looks like this:
AND (((wp_posts.post_title LIKE '%disquiet%') OR (wp_posts.post_content LIKE '%disquiet%')))
Default search includes the wildcards as shown above, which is most likely what you're looking for. If you want an exact search, you can also pass a query var of
"exact" => true.
For the details see the
get_posts method of
WP_Query in wp-includes/query.php.