[wp-hackers] search_query in a plugin

Dhanushka Samarakoon dhanu80 at gmail.com
Fri Oct 8 16:02:00 UTC 2010


Hi,
The following piece of code works inside a template file.
    <?php
         $search_query = new WP_Query();
         $search_posts = $search_query->query('s=computer');
         echo sizeof($search_posts);
    ?>
But it doesn't work inside a plugins php file. Does anyone know what changes
I should make to get that piece of code work inside a plugin?
Thanks.


More information about the wp-hackers mailing list