diff --git a/wp-admin/post.php b/wp-admin/post.php index c932d72e18..22624dfce2 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -16,7 +16,9 @@ $submenu_file = 'edit.php'; wp_reset_vars( array( 'action' ) ); -if ( isset( $_GET['post'] ) ) { +if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) { + wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 ); +} elseif ( isset( $_GET['post'] ) ) { $post_id = $post_ID = (int) $_GET['post']; } elseif ( isset( $_POST['post_ID'] ) ) { $post_id = $post_ID = (int) $_POST['post_ID']; @@ -40,6 +42,10 @@ if ( $post ) { $post_type_object = get_post_type_object( $post_type ); } +if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) { + wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 ); +} + if ( isset( $_POST['deletepost'] ) ) { $action = 'delete'; } elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' == $_POST['wp-preview'] ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 14bc1992ba..678b3fb203 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta3-44725'; +$wp_version = '5.1-beta3-44726'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.