Include all your WordPress custom post types in search

by

in

What i love in WordPress 3.0+ is the fact that you can create as many custom post types as you want to properly separate your contents. And there’s something i see pretty often when when i’m working with people that use CPTs: their CPTs are not included in their search, and that’s big problem because some of them nearly don’t use posts but only CPTs, so here is a quick tip to explain you how you can automatically add your CPTs to your search. Adding WordPress custom post types in search has never been so easy.

Just add this code to your theme functions.php file or in any file of your plugins:

How to add WordPress custom post types in search

5 responses to “Include all your WordPress custom post types in search”

  1. AJ Clarke

    Nice bit of code Remi ;)

  2. Monica

    Awesome, this will come in handy, thanks :)

  3. bhavhirani

    hi Rémi

    but can i include from my custom table in search ..?

    thanks

Leave a Reply