Ticket #32565: ajax-actions.diff
File ajax-actions.diff, 1.6 KB (added by , 10 years ago) |
---|
-
ajax-actions.php
1189 1189 $x->send(); 1190 1190 } 1191 1191 $_POST = $save_POST; // Now we can restore original $_POST again 1192 if ( !$mid = add_meta( $pid ) ) 1193 wp_die( __( 'Please provide a custom field value.' ) ); 1192 if ( !$mid = add_meta( $pid ) ) { 1193 if( '#NONE#' == $_POST['metakeyselect'] && !empty( $_POST['metakeyinput'] ) && is_protected_meta( $_POST['metakeyinput'] ) ) { 1194 wp_die( __( 'Please provide a valid meta name' ) ); 1195 } 1196 else { 1197 wp_die( __( 'Please provide a custom field value.' ) ); 1198 } 1199 } 1194 1200 } else { 1195 1201 wp_die( 0 ); 1196 1202 } 1197 1203 } elseif ( ! $mid = add_meta( $pid ) ) { 1198 wp_die( __( 'Please provide a custom field value.' ) ); 1204 1205 if( '#NONE#' == $_POST['metakeyselect'] && !empty( $_POST['metakeyinput'] ) && is_protected_meta( $_POST['metakeyinput'] ) ) { 1206 wp_die( __( 'Please provide a valid meta name' ) ); 1207 } 1208 else { 1209 wp_die( __( 'Please provide a custom field value.' ) ); 1210 } 1211 1199 1212 } 1200 1213 1201 1214 $meta = get_metadata_by_mid( 'post', $mid ); … … 1214 1227 $value = wp_unslash( $_POST['meta'][$mid]['value'] ); 1215 1228 if ( '' == trim($key) ) 1216 1229 wp_die( __( 'Please provide a custom field name.' ) ); 1230 if( is_protected_meta( $key ) ) { 1231 wp_die( __( 'Please provide a valid meta name' ) ); 1232 } 1217 1233 if ( '' == trim($value) ) 1218 1234 wp_die( __( 'Please provide a custom field value.' ) ); 1219 1235 if ( ! $meta = get_metadata_by_mid( 'post', $mid ) )