From 313283608034d608b6d6c17b5b1f12fe402cb1e2 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 14 Jun 2016 01:36:59 +0000 Subject: [PATCH] Taxonomy: More specific cap check when processing category data on post save. Props dlh. Fixes #36379. git-svn-id: https://develop.svn.wordpress.org/trunk@37691 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/post.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index 6ef84ba655..bd58325d9a 100644 --- a/src/wp-admin/includes/post.php +++ b/src/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; }