WordPress.org

Make WordPress Core

Changeset 42143


Ignore:
Timestamp:
11/10/2017 01:43:07 PM (4 years ago)
Author:
johnbillion
Message:

Docs: Improve inline docs for the wp_redirect() and wp_safe_redirect() functions.

See #42505, #42108

File:
1 edited

Legend:

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

    r41704 r42143  
    11691169 *
    11701170 * Exiting can also be selectively manipulated by using wp_redirect() as a conditional
    1171  * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_location'} hooks:
     1171 * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_location'} filters:
    11721172 *
    11731173 *     if ( wp_redirect( $url ) ) {
     
    11791179 * @global bool $is_IIS
    11801180 *
    1181  * @param string $location The path to redirect to.
    1182  * @param int    $status   Status code to use.
    1183  * @return bool False if $location is not provided, true otherwise.
     1181 * @param string $location The path or URL to redirect to.
     1182 * @param int    $status   Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
     1183 * @return bool False if the redirect was cancelled, true otherwise.
    11841184 */
    11851185function wp_redirect($location, $status = 302) {
     
    11911191     * @since 2.1.0
    11921192     *
    1193      * @param string $location The path to redirect to.
    1194      * @param int    $status   Status code to use.
     1193     * @param string $location The path or URL to redirect to.
     1194     * @param int    $status   The HTTP response status code to use.
    11951195     */
    11961196    $location = apply_filters( 'wp_redirect', $location, $status );
    11971197
    11981198    /**
    1199      * Filters the redirect status code.
     1199     * Filters the redirect HTTP response status code to use.
    12001200     *
    12011201     * @since 2.3.0
    12021202     *
    1203      * @param int    $status   Status code to use.
    1204      * @param string $location The path to redirect to.
     1203     * @param int    $status   The HTTP response status code to use.
     1204     * @param string $location The path or URL to redirect to.
    12051205     */
    12061206    $status = apply_filters( 'wp_redirect_status', $status, $location );
     
    12801280 * but only used in a few places.
    12811281 *
     1282 * Note: wp_safe_redirect() does not exit automatically, and should almost always be
     1283 * followed by a call to `exit;`:
     1284 *
     1285 *     wp_safe_redirect( $url );
     1286 *     exit;
     1287 *
    12821288 * @since 2.3.0
    12831289 *
    1284  * @param string $location The path to redirect to.
    1285  * @param int    $status   Status code to use.
     1290 * @param string $location The path or URL to redirect to.
     1291 * @param int    $status   Optional. HTTP response status code to use. Default '302' (Moved Temporarily).
    12861292 */
    12871293function wp_safe_redirect($location, $status = 302) {
     
    12961302     *
    12971303     * @param string $fallback_url The fallback URL to use by default.
    1298      * @param int    $status       The redirect status.
     1304     * @param int    $status       The HTTP response status code to use.
    12991305     */
    13001306    $location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
Note: See TracChangeset for help on using the changeset viewer.