| 1251 | $mid = add_meta( $pid ); |
| 1252 | if ( false === $mid ) { |
| 1253 | $metakeyselect = isset( $_POST['metakeyselect'] ) ? wp_unslash( trim( $_POST['metakeyselect'] ) ) : ''; |
| 1254 | $metakeyinput = isset( $_POST['metakeyinput'] ) ? wp_unslash( trim( $_POST['metakeyinput'] ) ) : ''; |
| 1255 | $metavalue = isset( $_POST['metavalue'] ) ? $_POST['metavalue'] : ''; |
| 1256 | if ( '#NONE#' !== $metakeyselect ) { |
| 1257 | $metakey = $metakeyselect; |
| 1258 | } |
| 1259 | if ( ! empty( $metakeyinput ) ) { |
| 1260 | $metakey = $metakeyinput; |
| 1261 | } |
| 1262 | if ( is_protected_meta( $metakey, 'post' ) || ! current_user_can( 'add_post_meta', $pid, $metakey ) ) { |
| 1263 | wp_die( __( 'You are not allowed to edit this custom field.' ) ); |
| 1264 | } else { |
| 1265 | wp_die( __( 'Please provide a custom field value.' ) ); |
| 1266 | } |
| 1267 | } |