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:
dd32 2010-04-24 03:53:47 +00:00
parent 4b0484781c
commit 63de1db1e9
1 changed files with 4 additions and 0 deletions

View File

@ -840,6 +840,10 @@ case 'add-meta' :
$mid = (int) array_pop(array_keys($_POST['meta'])); $mid = (int) array_pop(array_keys($_POST['meta']));
$key = $_POST['meta'][$mid]['key']; $key = $_POST['meta'][$mid]['key'];
$value = $_POST['meta'][$mid]['value']; $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 ) ) if ( !$meta = get_post_meta_by_id( $mid ) )
die('0'); // if meta doesn't exist die('0'); // if meta doesn't exist
if ( !current_user_can( 'edit_post', $meta->post_id ) ) if ( !current_user_can( 'edit_post', $meta->post_id ) )