From e9c53ad0d5b56f44d96177334c9df5e016ade6b1 Mon Sep 17 00:00:00 2001 From: Juliette <663378+jrfnl@users.noreply.github.com> Date: Sun, 24 Mar 2019 22:59:41 +0100 Subject: [PATCH] Bug fix: prevent an "undefined index" notice (#45) The `$_POST['data']` key might be set, while the `$_POST['data']['wp_autosave']` subkey is not set. --- wp-post-meta-revisions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-post-meta-revisions.php b/wp-post-meta-revisions.php index 4968d3d..eb1a894 100644 --- a/wp-post-meta-revisions.php +++ b/wp-post-meta-revisions.php @@ -58,7 +58,7 @@ public function _wp_autosave_post_revisioned_meta_fields( $new_autosave ) { * The post data arrives as either $_POST['data']['wp_autosave'] or the $_POST * itself. This sets $posted_data to the correct variable. */ - $posted_data = isset( $_POST['data'] ) ? $_POST['data']['wp_autosave'] : $_POST; // WPCS: CSRF ok. input var ok. sanitization ok. + $posted_data = isset( $_POST['data']['wp_autosave'] ) ? $_POST['data']['wp_autosave'] : $_POST; // WPCS: CSRF ok. input var ok. sanitization ok. /* * Go thru the revisioned meta keys and save them as part of the autosave, if