Skip to content

Commit

Permalink
Bug fix: prevent an "undefined index" notice (#45)
Browse files Browse the repository at this point in the history
The `$_POST['data']` key might be set, while the `$_POST['data']['wp_autosave']` subkey is not set.
  • Loading branch information
jrfnl authored and Adam Silverstein committed Mar 24, 2019
1 parent 6750ac8 commit e9c53ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wp-post-meta-revisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e9c53ad

Please sign in to comment.