SharePoint Online: Change “Search this site” text in Search Box

Requirement: Change the “Search this site” default placeholder text in the SharePoint Online site search box.

How to Set the Search Box Text in SharePoint Online?

By default, the site search box in the modern SharePoint Online search box has the text “Search this site”. To make it more relevant, we can change this placeholder text to something meaningful. E.g. wouldn’t it make more sense to set it as “Search Operations Portal” instead of saying “Search this site” in the Operations portal site?

change search this site placeholder text in sharepoint online

Well, Here is the PowerShell script to change the search box default text:

#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/Operations"
$SearchBoxText ="Search Operations Portal"

#Connect to the site
Connect-PnPOnline -Url $SiteURL -UseWebLogin

#Set the default search box text
Set-PnPSearchSettings -Scope Site -SearchBoxPlaceholderText $SearchBoxText

And the result:

set search this site text in sharepoint online

You can also set the search box’s placeholder text at the web level as:

Set-PnPSearchSettings -Scope Web -SearchBoxPlaceholderText $SearchBoxText

To reset to the default text, use:

#Reset to the default search box text
Set-PnPSearchSettings -Scope Site -SearchBoxPlaceholderText ""

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply