Including custom post types in the WordPress search results can be a bit tricky, but it’s definitely worth the effort. In this snippet, we’ll show you how to include your custom post types in the results, as well as how to customize the search experience for your users.
If you’re a web designer or developer, then you know how important it is to make your client’s website searchable. In this snippet post, we’ll show you how to include custom post types in the WordPress search results. This will allow your clients’ visitors to find the content they’re looking for quickly and easily. So, whether you’re just getting started with WordPress or are a seasoned pro, this code snippet is for you! Let’s get started!
This function is designed to help you filter your search results by adding new arguments. As seen below, it will return content from each of these custom post types:
posts, players, clubs, & folio – all simply changing or deleting the names in array below!