Search outside of the “loop”

You can use get_posts() with a search parameter:

$results = get_posts( array( 's' => 'search term' ) );

Leave a Comment