Follow these steps to check the results generated by the default WordPress search:
- Visit the home page of the site.
- Click the Search icon in the top-right corner to open the search box, as shown in the following screenshot:
- Type a word to search and press Enter. Make sure to use a word that is available in a post, a page, and a book post type we created earlier.
Now, you will see a list of results with the search keyword. Follow these steps to customize the search based on different conditions:
- Open the wpcookbookchapter8.php file using the code editor.
- Add the following code to allow logged-in users to search posts, pages, ...