What are you using currently to display the search term? Relevanssi doesn’t change it: for example, the default get_search_query() in WordPress works exactly the same with or without Relevanssi. You can also get the search term from the global $wp_query->query_vars['s']. If anything, Search & Filter Pro is more likely to change this.
Thank you for your reply. The following template code works to show the search term but only when Relevanssi is NOT enabled in the Search & Filter Pro search form. When I turn Relevanssi on the the search term does not show. Do you still think it’s a Search & Find issue?
<h1><?php
printf(
/* translators: %s: query term */
esc_html__( 'Search Results for: %s', 'picostrap' ),
'"' . get_search_query() . '"'
);
?></h1>
-
This reply was modified 1 year, 10 months ago by
trishahdee.
-
This reply was modified 1 year, 10 months ago by
trishahdee.
Well, get_search_query() gets the search terms from $wp_query->query_vars['s'], and Relevanssi doesn’t touch that, so I don’t know how Relevanssi would break it. If enabling Relevanssi breaks this, then Relevanssi is somehow involved, but it must be partly related to Search & Filter, because Relevanssi in itself does not break this. Unfortunately, I don’t have Search & Filter, so I can’t investigate this further. All I can say is that this should work. Have you tried asking the S&F Pro support?
I am working with S&F Pro support and will report back if/when there is a solution.
Success! The tech at S&F said your comments pointed him in the right direction. The code for this can be found on this web page: https://searchandfilter.com/documentation/accessing-search-data/
//Get the search term
//replace "1526" with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1526)->current_query();
echo $sf_current_query->get_search_term();
Thank you for your help!