The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Add a Custom Search Placeholder to WordPress Search Forms

Shared by Amit Dholiya · November 16, 2026

20 views
1 upvote
Back to Snippets

Steps

  1. Add the PHP code to your theme’s functions.php file or a PHP snippets plugin.

  2. Save and activate the snippet.

  3. Visit your website and check the search form.

/**
 * Change the default WordPress search placeholder
 */
function custom_search_placeholder_text( $html ) {

    $html = str_replace(
        'placeholder="Search …"',
        'placeholder="Search articles here..."',
        $html
    );

    return $html;
}

add_filter( 'get_search_form', 'custom_search_placeholder_text' );

Tested on

WordPress 6.8

Reported by the author on November 16, 2026. WPFolks has not verified this.

Not tested against WordPress 7.1.5. It may still work.

Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments

Proudly supported by