Excluding custom post type from a search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Excluding custom post type from a search

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #34268
    mahmood58
    mahmood58
    Participant

    Hello,

    I am facing an issue with one of my search bars (in total 2 on the site) and I was wondering if you can help me out. I want to exclude certain custom post types from the search result page. I have followed the guides that you have provided and also set the override method and yet it’s not working. I do see an option to exclude cpt by ID but I was wondering if there’s a way to place a code in functions.php that will exclude a list of cpts?

    Thanks!

    #34272
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    By default, the plugin should return only the post types selected under the General Options -> Sources panel: https://i.imgur.com/Qh6Vazb.png
    Was the search executed via the plugin search field?
    If yes, and the override is still not working, you can still try this option.
    If it is still not working, then there is very likely a custom query somewhere in the search template file, or in the theme functions.php file. There is certainly a way to exclude post types from that query, however it depends on the implementation – so you may need to ask the theme author about that.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.