Make WordPress Core


Ignore:
Timestamp:
09/23/2019 05:24:58 PM (6 years ago)
Author:
kadamwhite
Message:

REST API: Pass "null" as the post date property to reset post to initial "floating" date value.

Props TimothyBlynJacobs, adamsilverstein, jnylen0, mnelson4.
Fixes #44975.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-request.php

    r46206 r46249  
    399399
    400400    /**
     401     * Checks if a parameter exists in the request.
     402     *
     403     * This allows distinguishing between an omitted parameter,
     404     * and a parameter specifically set to null.
     405     *
     406     * @since 5.3.0
     407     *
     408     * @param string $key Parameter name.
     409     *
     410     * @return bool True if a param exists for the given key.
     411     */
     412    public function has_param( $key ) {
     413        $order = $this->get_parameter_order();
     414
     415        foreach ( $order as $type ) {
     416            if ( array_key_exists( $key, $this->params[ $type ] ) ) {
     417                return true;
     418            }
     419        }
     420
     421        return false;
     422    }
     423
     424    /**
    401425     * Sets a parameter on the request.
    402426     *
Note: See TracChangeset for help on using the changeset viewer.