Skip to Content

redirect_empty_search()

Prevent empty search query error page.

PHP April 27, 2017

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Source File

Located in /libs/Functions.php on line 2269.

No Hooks

This function does not have any filters or actions available. Request one?
PHP
    public function redirect_empty_search($query){
        global $wp_query;
        if ( isset($_GET['s']) && $wp_query->query && !array_key_exists('invalid', $_GET) ){
            if ( $_GET['s'] == '' && $wp_query->query['s'] == '' && !$this->is_admin_page() ){
                header('Location: ' . home_url('/') . 'search/?invalid');
                exit;
            } else {
                return $query;
            }
        }
    }

Override

This function can not be short-circuited with an override filter. Request one?