Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Specific custom post type not showing up in search results
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year, 3 months ago.
- AuthorPosts
- December 5, 2022 at 8:03 am #40383
Hi Ernest,
I have a development site, where I’ve set up a couple of CPTs using the CPT UI plugin, and these post types successfully show up in my search results, and I can filter down my results by my custom “content type” field (added via Advanced Custom Fields). So all of that is working beautifully.
I recently added a new “event” CPT via the “Events Manager” plugin, and for the life of me, I can’t get my events to show up in the search results.
I have added the ‘event’ CPT to my Search Sources > Post Type Search List settings AND also to my Index table settings, and have regenerated the index (repeatedly).
I know that the events have been indexed, because the title of one shows up as the autocomplete value when I start typing a relevant search term, but they stubbornly refuse to appear in my list of results.
I checked my search results template, and have confirmed that “Event” type posts are included in the Divi post list element I’m using, so that shouldn’t be the issue either.
Interestingly, my first page of results, that should include my event, is supposed to display 18 results, but actually only lists 17, as if the event is being returned in the query (and result count), but then is not displayed for some reason.
The issue persists (no events included, 17 listings on the first page) even if I disable all plugins (apart from the four ones I’m using – Ajax Search, ACF, CPT UI, Events Manager) and change to the Twenty Three theme.
One of my two test events does actually show up in the live search results, while the other doesn’t show up even when I type the exact name. However, the event that shows up in the live hover list of results, does not show up on the search results page.
I’ve read the documentation, searched the knowledge hub and forums, and I can’t find anything else that I think I should have done.
I’m really confused about what’s happening here. What am I missing? Is there anything that you can suggest to get this working?
Thank you,
Nikki
December 5, 2022 at 2:33 pm #40402Hi Nikki,
This could be in relation to a WordPress WP_Query bug, which was recently noticed. I have changed one of the sub-queries to use the “post_type=>”any” argument, which apparently is not working as it should in WordPress for some reasons.
Anyways, can you please try the following fix:
Best,
– Please open thewp-content/plugins/ajax-search-pro/includes/classes/Search/SearchIndex.php
file on your server
– Replace it’s content with this
– Save, and try the search again
If all goes well, the results should start appearing immediately.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
December 5, 2022 at 11:47 pm #40419Brilliant! That fixed it perfectly.
Thank you so much.
December 6, 2022 at 11:22 am #40429You are welcome, I will mark this as resolved and this is going to be included in the next patch.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.