Make WordPress Core

Changeset 34509


Ignore:
Timestamp:
09/24/2015 06:51:13 PM (11 years ago)
Author:
DrewAPicture
Message:

Docs: Improve the summary and description for the pre_http_request filter docs to better illustrate expected values.

The filter explicitly expects one of three passed value types:

  • An array containing 'headers', 'body', 'response', 'cookies', and 'filename' elements
  • A WP_Error instance
  • Boolean false (to avoid short-circuiting the response)

Props johnbillion.
Fixes #33995.

File:
1 edited

Legend:

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

    r34174 r34509  
    160160
    161161                /**
    162                  * Filter whether to preempt an HTTP request's return.
    163                  *
    164                  * Returning a truthy value to the filter will short-circuit
    165                  * the HTTP request and return early with that value.
     162                 * Filter whether to preempt an HTTP request's return value.
     163                 *
     164                 * Returning a non-false value from the filter will short-circuit the HTTP request and return
     165                 * early with that value. A filter should return either:
     166                 *
     167                 *  - An array containing 'headers', 'body', 'response', 'cookies', and 'filename' elements
     168                 *  - A WP_Error instance
     169                 *  - boolean false (to avoid short-circuiting the response)
     170                 *
     171                 * Returning any other value may result in unexpected behaviour.
    166172                 *
    167173                 * @since 2.9.0
    168174                 *
    169                  * @param bool   $preempt Whether to preempt an HTTP request return. Default false.
    170                  * @param array  $r       HTTP request arguments.
    171                  * @param string $url     The request URL.
     175                 * @param false|array|WP_Error $preempt Whether to preempt an HTTP request's return value. Default false.
     176                 * @param array               $r        HTTP request arguments.
     177                 * @param string              $url      The request URL.
    172178                 */
    173179                $pre = apply_filters( 'pre_http_request', false, $r, $url );
     180
    174181                if ( false !== $pre )
    175182                        return $pre;
Note: See TracChangeset for help on using the changeset viewer.