apply_filters( 'wp_redirect_status', int $status, string $location )

Filters the redirect HTTP response status code to use.


Parameters Parameters

$status

(int) The HTTP response status code to use.

$location

(string) The path or URL to redirect to.


Top ↑

Source Source

File: wp-includes/pluggable.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by stevenlinx

    Example Migrated from Codex:

    Convert HTTP/1.1-only status codes to 1.0 equivalents when using HTTP/1.0

    add_filter( 'wp_redirect_status', 'http_status_version_downgrade');
    
    function http_status_version_downgrade($status, $location) {
    
        static $HTTP11_to_10 = array(
            203 => 200,
            303 => 302, 307 => 302, /* 305 => No 1.0 equivalent ,*/
        );
    
        if( $_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.0' 
            && isset($HTTP11_to_10[$status]) ) 
        {
            return $HTTP11_to_10[$status];
        }
    
        return $status;
    }
    

You must log in before being able to contribute a note or feedback.