Keyword Searching with WP_Query
Learn to replace the hard coded search term with a user input.
We will now modify the custom query arguments to add a search string that filters out results returned by our custom REST API. The WP_Query
object has a search parameter which shows posts based on a search keyword. The parameter is called s
and it takes the keyword as a string.
Search parameter
If we want to search for a teacher post which has the word jane in it, we will use the following array of arguments.
Get hands-on with 1400+ tech skills courses.