Show proper error when adding a custom field without a value, props scohoust, fixes #7541

git-svn-id: http://svn.automattic.com/wordpress/trunk@10957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz
2009-04-16 21:55:35 +00:00
parent c69b14d5b6
commit dee602f501
2 changed files with 10 additions and 5 deletions
+4 -1
View File
@@ -677,10 +677,13 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
if ( in_array($meta_key, $protected) )
return false;
if ( '' === trim( $meta_value ) )
return false;
$post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) );
wp_cache_delete($post_id, 'post_meta');
$meta_value = maybe_serialize( stripslashes( $meta_value ));
$meta_value = maybe_serialize( stripslashes( $meta_value ) );
$meta_id = (int) $meta_id;
$data = compact( 'meta_key', 'meta_value' );