I have a simple question, but can’t find the answer anywhere. What exactly does the ‘s’ parameter search when used in a query? Ex:
$args = array(
's' => $keyword
);
$query = new WP_Query($args);
Does it just search post content, or does it also look at title, tags, etc?
EDIT: Just to clarify. The question is what post fields are being searched, not what data is being returned.
1 Answer
As usual it’s most reliable to dump the resulting SQL query and see:
SELECT wp_posts.ID
FROM wp_posts
WHERE 1=1
AND (((wp_posts.post_title LIKE '%keyword%')
OR (wp_posts.post_content LIKE '%keyword%')))
AND wp_posts.post_type="post"
AND ((wp_posts.post_status="publish"))
ORDER BY wp_posts.post_date DESC LIMIT 0,5
The only two things native search is considering are title and content.