Add descriptive error messages on Custom Fields updates attempting to set a empty Key or Value. Fixes #11650

git-svn-id: https://develop.svn.wordpress.org/trunk@14214 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2010-04-24 03:53:47 +00:00
parent af6fe3689a
commit 75b0dcde46
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']));
$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 ) )