Searching for Custom Post Type
-
Hello.
I created a custom post type called portfolio to keep my portfolio itens, i created also a Page called Portfolio to get all custom post type from portfolio and everything works properly.
So i decided to create a search because I have a good amount of items and will be more ease to search for something. Searching on Google i found a topic that says to put a hidden field on my search form.
<input type=”hidden” name=”post_type” value=”portfolio” />
Where portfolio is the name of my custom post type. When i try to search for something, the address looks like this:
https://www.mysite.com/?s=search word&post_type=portfolio
Theory was to work, but returns nothing, and if i take off the ?s=search word and just let ?post_type=portfolio the page return all my custom post type, in other words, it was to be working.
I used Custom Post Types UI plugin to create my custom post type and its set public and query var to true.
Someone could tell me what can I do to get this problem fix?
Thanks!
[]s
- The topic ‘Searching for Custom Post Type’ is closed to new replies.