|

How to Change the “Search Results For” String

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.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

On this page

Download is Just A Click Away!

Membership Retention Checklist Download

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form