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
This commit is contained in:
Boone Gorges 2016-06-14 01:36:59 +00:00
parent 84a19f4a93
commit 3132836080

View File

@ -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'] ); $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; return $post_data;
} }