Skip to content

Commit 942eaa1

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 821cd3e + 0d59cc4 commit 942eaa1

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/wp-admin/includes/ajax-actions.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ function wp_ajax_add_meta() {
16211621
$post = get_post( $post_id );
16221622

16231623
if ( isset( $_POST['metakeyselect'] ) || isset( $_POST['metakeyinput'] ) ) {
1624-
if ( ! current_user_can( 'edit_post', $post_id ) ) {
1624+
if ( ! $post || ! current_user_can( 'edit_post', $post_id ) ) {
16251625
wp_die( -1 );
16261626
}
16271627

@@ -2106,6 +2106,9 @@ function wp_ajax_inline_save() {
21062106
$data = &$_POST;
21072107

21082108
$post = get_post( $post_id, ARRAY_A );
2109+
if ( ! $post ) {
2110+
wp_die();
2111+
}
21092112

21102113
// Since it's coming from the database.
21112114
$post = wp_slash( $post );
@@ -3134,6 +3137,9 @@ function wp_ajax_save_attachment() {
31343137

31353138
$changes = $_REQUEST['changes'];
31363139
$post = get_post( $id, ARRAY_A );
3140+
if ( ! $post ) {
3141+
wp_send_json_error();
3142+
}
31373143

31383144
if ( 'attachment' !== $post['post_type'] ) {
31393145
wp_send_json_error();
@@ -3225,6 +3231,9 @@ function wp_ajax_save_attachment_compat() {
32253231
}
32263232

32273233
$post = get_post( $id, ARRAY_A );
3234+
if ( ! $post ) {
3235+
wp_send_json_error();
3236+
}
32283237

32293238
if ( 'attachment' !== $post['post_type'] ) {
32303239
wp_send_json_error();

0 commit comments

Comments
 (0)