If you’re using Astra’s search option on a website and want to change the default string “Search Results For,” you’re in luck! This article will guide you through the process.
To modify the above string, add the following code to your child theme’s functions.php file.
add_filter( 'astra_the_search_page_title', 'my_function', 10 );
function my_function() {
return sprintf( __( 'Add Custom Text Here: %s', 'astra' ), '<span>' . get_search_query() . '</span>' );
}
Here’s how you can do it:
Navigate to Appearance > Theme File Editor, and access the functions.php file.
Paste the above code here and click on the Update File button.
Verify these changes on your website.
That’s it! The text inside “return sprintf( __( ‘Add Custom Text Here: %s’, ‘astra’ )” in the code can be replaced according to your preferred text.
If you face any issues with the above, please reach out to our support team.