WordPress Function to Remove role=”search” attributes for get_search_form()

function remove_role_search($role)
{
    $result = array();
    preg_match_all('|role="[^"]*"|U', $role, $result);
    foreach ($result[0] as $role_tag) {
        $role = str_replace($role_tag, '', $role);
    }
    return $role;
}
add_filter('get_search_form', 'remove_role_search');

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *