• I would like to remove the search placeholder text in the Twenty Nineteen theme widget. The placeholder text is as follows: “Search …”

    I tried the following code (added to my functions.php file – child theme):

    // Change placeholder text for search widget
    function wpforo_search_form( $html ) {
    
            $html = str_replace( 'placeholder="Search ', 'placeholder=" ', $html );
    
            return $html;
    }
    add_filter( 'get_search_form', 'wpforo_search_form' );

    The above code removes “Search” but leaves the 3 dots (…).

    I tried this:

    // Change placeholder text for search widget
    function wpforo_search_form( $html ) {
    
            $html = str_replace( 'placeholder="Search … ', 'placeholder=" ', $html );
    
            return $html;
    }
    add_filter( 'get_search_form', 'wpforo_search_form' );

    The above code doesn’t work at all.

    What am I missing? Thanks in advance.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try removing the filter and adding your own:

    
    remove_filter( 'get_search_form', 'wpforo_search_form');
    
    // Change placeholder text for search widget
    function child_wpforo_search_form( $html ) {
    
            $html = str_replace( 'placeholder="Search … ', 'placeholder=" ', $html );
    
            return $html;
    }
    add_filter( 'get_search_form', 'child_wpforo_search_form' );
    
    • This reply was modified 5 years, 5 months ago by Andrew Nevins.
    Thread Starter ns888

    (@ns888)

    @anevins It doesn’t work. Continues to display “Search …”

    FYI, I’m not using wpForo (found this function when researching the issue). Strange that it works when you only want to remove “Search” and leave the 3 dots.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove search field placeholder text (Twenty Nineteen child theme)’ is closed to new replies.