Add descriptive error messages on Custom Fields updates attempting to set a empty Key or Value. Fixes #11650
git-svn-id: http://svn.automattic.com/wordpress/trunk@14214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4b0484781c
commit
63de1db1e9
|
@ -840,6 +840,10 @@ case 'add-meta' :
|
|||
$mid = (int) array_pop(array_keys($_POST['meta']));
|
||||
$key = $_POST['meta'][$mid]['key'];
|
||||
$value = $_POST['meta'][$mid]['value'];
|
||||
if ( '' == trim($key) )
|
||||
die(__('Please provide a custom field name.'));
|
||||
if ( '' == trim($value) )
|
||||
die(__('Please provide a custom field value.'));
|
||||
if ( !$meta = get_post_meta_by_id( $mid ) )
|
||||
die('0'); // if meta doesn't exist
|
||||
if ( !current_user_can( 'edit_post', $meta->post_id ) )
|
||||
|
|
Loading…
Reference in New Issue