- December 5, 2022 at 8:03 am #40383
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?
NikkiDecember 5, 2022 at 2:33 pm #40402
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 the
wp-content/plugins/ajax-search-pro/includes/classes/Search/SearchIndex.phpfile 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.
If you like my products, don't forget to rate them on codecanyon :)
December 5, 2022 at 11:47 pm #40419
Brilliant! That fixed it perfectly.
Thank you so much.December 6, 2022 at 11:22 am #40429
You must be logged in to reply to this topic.