From b4bf158d3a28e71cdac24b4cccf0b762f98b96c8 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 21 Jun 2016 14:21:38 +0000 Subject: [PATCH] Taxonomy: More specific cap check when processing category data on post save. Ports [37691] to the 4.2 branch. Props dlh. Fixes #36379. Built from https://develop.svn.wordpress.org/branches/4.2@37776 git-svn-id: http://core.svn.wordpress.org/branches/4.2@37741 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/post.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 3885c2e131..dfd7e6eae1 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -165,6 +165,13 @@ function _wp_translate_postdata( $update = false, $post_data = null ) { $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); } + if ( isset( $post_data['post_category'] ) ) { + $category_object = get_taxonomy( 'category' ); + if ( ! current_user_can( $category_object->cap->assign_terms ) ) { + unset( $post_data['post_category'] ); + } + } + return $post_data; }