mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +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, danielbachhuber. Merges [43811] to trunk. Fixes #43559. git-svn-id: https://develop.svn.wordpress.org/trunk@44153 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -799,4 +799,21 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
||||
$this->assertArrayHasKey( $name, $blocks );
|
||||
$this->assertSame( array( 'icon' => 'text' ), $blocks[ $name ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 43559
|
||||
*/
|
||||
public function test_post_add_meta_empty_is_allowed() {
|
||||
$p = self::factory()->post->create();
|
||||
|
||||
$_POST = array(
|
||||
'metakeyinput' => 'testkey',
|
||||
'metavalue' => '',
|
||||
);
|
||||
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$this->assertNotFalse( add_meta( $p ) );
|
||||
$this->assertEquals( '', get_post_meta( $p, 'testkey', true ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user