I am trying to:
Display custom post contents on search.php
Link to a page where the issue can be seen: hidden link
I expected to see:
Customs posts as result (like few day ago). I manage relevansi plugin to display only a custom post, produce with toolset.
Instead, I got: Nothing, However $wp_query->found_posts in search.php seems working. the problem is when starting lines : while (have_posts ()): the_post () in search.php
If you are using the theme's search.php template to output the search results then Toolset doesn't appear involved in any way other than using Types to register the custom post type.
Custom post types are not included in search results, you would need to manually intervene so that they are.
Typically you would do so by using the pre_get_posts filter and modifying the main query on the search archive page so that it also includes the post types you require.
(I'm not sure whether Relevanssi normally does this for you, you'd have to consult their documentation. We have an integration with Relevanssi, but that is for when you are using Views to output search results, but you are using the search.php theme template.)
You would want to add something like this:
function tssupp_filter_search_query($query) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_search) {
$query->set('post_type', array( 'post', 'my-post-type', 'other-post-type' ) );
}
}
}
add_action('pre_get_posts','tssupp_filter_search_query');
You specify an array of post types to be included in the search.
Can you try temporarily disabling all plugins except for Toolset Types and then try again and let me know if that works? It may be another plugin is interfering here.