From 32d5e7f31dfdd9bdeb6ca743110ddd086336abea Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 26 Aug 2016 18:23:31 +0000 Subject: [PATCH] Role/Capability: Only users who can manage options should be able to trash/delete the page for posts or the front page, as they are the only users who can restore it or subsequently alter the "Front page displays" setting. Fixes #37580 Props JakePT Built from https://develop.svn.wordpress.org/trunk@38378 git-svn-id: http://core.svn.wordpress.org/trunk@38319 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/capabilities.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index eac359630b..da542293dd 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -67,6 +67,11 @@ function map_meta_cap( $cap, $user_id ) { } } + if ( ( get_option( 'page_for_posts' ) == $post->ID ) || ( get_option( 'page_on_front' ) == $post->ID ) ) { + $caps[] = 'manage_options'; + break; + } + $post_type = get_post_type_object( $post->post_type ); if ( ! $post_type ) { /* translators: 1: post type, 2: capability name */ diff --git a/wp-includes/version.php b/wp-includes/version.php index 730e474090..4d1501643a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38377'; +$wp_version = '4.7-alpha-38378'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.