Make WordPress Core

Changeset 57693


Ignore:
Timestamp:
02/22/2024 10:56:26 AM (8 months ago)
Author:
swissspidy
Message:

Docs: Improve docblock for $x_redirect_by param in wp_redirect().

The $x_redirect_by parameter is supported by wp_redirect() and wp_safe_redirect() to set the X-Redirect-By header.
It can be modified via the x_redirect_by filter.

This updates the docblock to clarify that false can be passed to disable sending the header, which was previously undocumented behavior.

Props kkmuffme, swissspidy.
Fixes #60209.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable.php

    r57226 r57693  
    13781378     * @global bool $is_IIS
    13791379     *
    1380      * @param string $location      The path or URL to redirect to.
    1381      * @param int    $status        Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
    1382      * @param string $x_redirect_by Optional. The application doing the redirect. Default 'WordPress'.
     1380     * @param string       $location      The path or URL to redirect to.
     1381     * @param int          $status        Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
     1382     * @param string|false $x_redirect_by Optional. The application doing the redirect or false to omit. Default 'WordPress'.
    13831383     * @return bool False if the redirect was canceled, true otherwise.
    13841384     */
     
    14271427         * @since 5.1.0
    14281428         *
    1429          * @param string $x_redirect_by The application doing the redirect.
    1430          * @param int    $status        Status code to use.
    1431          * @param string $location      The path to redirect to.
     1429         * @param string|false $x_redirect_by The application doing the redirect or false to omit the header.
     1430         * @param int          $status        Status code to use.
     1431         * @param string       $location      The path to redirect to.
    14321432         */
    14331433        $x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location );
     
    15211521     * @since 5.1.0 The return value from wp_redirect() is now passed on, and the `$x_redirect_by` parameter was added.
    15221522     *
    1523      * @param string $location      The path or URL to redirect to.
    1524      * @param int    $status        Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
    1525      * @param string $x_redirect_by Optional. The application doing the redirect. Default 'WordPress'.
     1523     * @param string       $location      The path or URL to redirect to.
     1524     * @param int          $status        Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
     1525     * @param string|false $x_redirect_by Optional. The application doing the redirect or false to omit. Default 'WordPress'.
    15261526     * @return bool False if the redirect was canceled, true otherwise.
    15271527     */
Note: See TracChangeset for help on using the changeset viewer.