WooCommerce out of stock products can be excluded from search result by using the _stock_status meta key of products. This meta key checks if a product is in stock or not. We can modify search query using pre_get_posts action hook and load only instock products. Code goes in the functions.php… Read More »
Tag: is_search
Include custom post types in WordPress default search result
WordPress default search only works for post and page. When you search with the default search form, it will only look for a result within posts and pages. If you have custom post types, that will be ignored. Also you may want to exclude post or page from search results…. Read More »