Make WordPress Core

Ticket #45799: 45799.diff

File 45799.diff, 845 bytes (added by ediamin, 6 years ago)

Proposed changes for WP_REST_Request::get_param method

  • src/wp-includes/rest-api/class-wp-rest-request.php

    diff --git a/src/wp-includes/rest-api/class-wp-rest-request.php b/src/wp-includes/rest-api/class-wp-rest-request.php
    index 26c1c0fb45..a4fb9c72d2 100644
    a b class WP_REST_Request implements ArrayAccess { 
    380380         * @since 4.4.0
    381381         *
    382382         * @param string $key Parameter name.
     383         * @param mixed  $default Optional. Default value to return if the key does not exist.
    383384         * @return mixed|null Value if set, null otherwise.
    384385         */
    385         public function get_param( $key ) {
     386        public function get_param( $key, $default = null ) {
    386387                $order = $this->get_parameter_order();
    387388
    388389                foreach ( $order as $type ) {
    class WP_REST_Request implements ArrayAccess { 
    392393                        }
    393394                }
    394395
    395                 return null;
     396                return $default;
    396397        }
    397398
    398399        /**