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 2409.

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($this->super->get['s']) && $wp_query->query && !array_key_exists('invalid', $this->super->get) ){
                if ( $this->super->get['s'] == '' && $wp_query->query['s'] == '' && !$this->is_admin_page() ){
                    header('Location: ' . home_url('/') . 'search/?invalid'); //Why not wp_redirect() here?
                    exit;
                } else {
                    return $query;
                }
            }
        }

Override

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