mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
REST API: Pass "null" as the post date property to reset post to initial "floating" date value.
Props TimothyBlynJacobs, adamsilverstein, jnylen0, mnelson4. Fixes #44975. git-svn-id: https://develop.svn.wordpress.org/trunk@46249 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -397,6 +397,30 @@ class WP_REST_Request implements ArrayAccess {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a parameter exists in the request.
|
||||
*
|
||||
* This allows distinguishing between an omitted parameter,
|
||||
* and a parameter specifically set to null.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*
|
||||
* @param string $key Parameter name.
|
||||
*
|
||||
* @return bool True if a param exists for the given key.
|
||||
*/
|
||||
public function has_param( $key ) {
|
||||
$order = $this->get_parameter_order();
|
||||
|
||||
foreach ( $order as $type ) {
|
||||
if ( array_key_exists( $key, $this->params[ $type ] ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter on the request.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user