I have two different pieces of code and it's returning two different results.
$search_query = new WP_Query();
$search_posts = $search_query->query('s=computer');
echo count($search_posts);
vs.
$search_posts = get_posts('s=computer');
echo count($search_posts);
What is the reason for the different values?
(The value provided by the first one is correct. It's the same as the number of posts that I get when I do a regular search in WP. But the first piece of code won't work inside the plugin's php file, it would work only in a template.)
Thanks.