I am creating a blog using only WordPress’s backend. I have found functions to get latest posts (wp_get_recent_posts) and all the required data I need. I do this by including wp-load so I have access to WP’s functions.
However I cannot find anything that allows me to perform a search outside of WordPress’s theming loops as I have for the rest of the data.
I was hoping there was a search function where I can pass it a search query that could be in title, body content or tag name.
Am I missing something blindingly obvious in the documentation, there seems to be a function for everything else I need outside of WP’s “loop”.
Does that work for you?
Source
Answered by sanchothefat:
You can use get_posts() with a search parameter:
https://wordpress.stackexchange.com/questions/74763/search-outside-of-the-loop/74766#74766