WordPress.org

Make WordPress Core

Ticket #44530: 44530.diff

File 44530.diff, 650 bytes (added by Kubitomakita, 3 years ago)
  • wp-admin/includes/ajax-actions.php

    diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
    index 04c31e51d3..e8a505802e 100644
    a b function wp_ajax_add_meta() { 
    13811381                        wp_die( 1 );
    13821382                }
    13831383
     1384                // If meta key is empty, return error.
     1385                if ( isset( $_POST['metakeyinput'] ) && empty( $_POST['metakeyinput'] ) ) {
     1386                        wp_die( __( 'Please provide a custom field name.' ) );
     1387                }
     1388
    13841389                // If the post is an autodraft, save the post as a draft and then attempt to save the meta.
    13851390                if ( $post->post_status == 'auto-draft' ) {
    13861391                        $post_data                = array();