Make WordPress Core

Changeset 34164


Ignore:
Timestamp:
09/15/2015 02:53:18 AM (9 years ago)
Author:
wonderboymusic
Message:

Add a filter to allow custom headers to be sent via the WP HTTP IXR client: 'wp_http_ixr_client_headers'.

Props ericmann.
Fixes #24598.

File:
1 edited

Legend:

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

    r32546 r34164  
    6565
    6666        // Merge Custom headers ala #8145
    67         foreach ( $this->headers as $header => $value )
     67        foreach ( $this->headers as $header => $value ) {
    6868            $args['headers'][$header] = $value;
     69        }
    6970
    70         if ( $this->timeout !== false )
     71        /**
     72         * Filter to allow custom headers to be sent
     73         *
     74         * @since 4.4.0
     75         *
     76         * @param array $headers Header collection to be sent to the XML-RPC server.
     77         */
     78        $args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] );
     79
     80        if ( $this->timeout !== false ) {
    7181            $args['timeout'] = $this->timeout;
     82        }
    7283
    7384        // Now send the request
    74         if ( $this->debug )
     85        if ( $this->debug ) {
    7586            echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
     87        }
    7688
    7789        $response = wp_remote_post($url, $args);
     
    89101        }
    90102
    91         if ( $this->debug )
     103        if ( $this->debug ) {
    92104            echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
     105        }
    93106
    94107        // Now parse what we've got back
Note: See TracChangeset for help on using the changeset viewer.