mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
Meta: Allow empty strings to be set by Custom Fields meta box.
Because the REST API allows meta keys to have empty values, the Custom Fields meta box should permit the same behavior. Props charlestonsw, soulseekah. Fixes #43559. Built from https://develop.svn.wordpress.org/branches/5.0@43811 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9cd179146c
commit
7e3414597f
@ -1341,8 +1341,6 @@ function wp_ajax_add_meta() {
|
||||
$value = wp_unslash( $_POST['meta'][$mid]['value'] );
|
||||
if ( '' == trim($key) )
|
||||
wp_die( __( 'Please provide a custom field name.' ) );
|
||||
if ( '' == trim($value) )
|
||||
wp_die( __( 'Please provide a custom field value.' ) );
|
||||
if ( ! $meta = get_metadata_by_mid( 'post', $mid ) )
|
||||
wp_die( 0 ); // if meta doesn't exist
|
||||
if ( is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) ||
|
||||
|
@ -814,7 +814,7 @@ function add_meta( $post_ID ) {
|
||||
if ( is_string( $metavalue ) )
|
||||
$metavalue = trim( $metavalue );
|
||||
|
||||
if ( ('0' === $metavalue || ! empty ( $metavalue ) ) && ( ( ( '#NONE#' != $metakeyselect ) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput ) ) ) {
|
||||
if ( ( ( '#NONE#' != $metakeyselect ) && ! empty( $metakeyselect ) ) || ! empty( $metakeyinput ) ) {
|
||||
/*
|
||||
* We have a key/value pair. If both the select and the input
|
||||
* for the key have data, the input takes precedence.
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.0-alpha-43810';
|
||||
$wp_version = '5.0-alpha-43811';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user