Taxonomy: More specific cap check when processing category data on post save.

Ports [37691] to the 4.1 branch.

Props dlh.
Fixes #36379.
Built from https://develop.svn.wordpress.org/branches/4.1@37781


git-svn-id: http://core.svn.wordpress.org/branches/4.1@37746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-06-21 14:22:56 +00:00
parent 65b88f9802
commit 79e7b2e6aa
1 changed files with 7 additions and 0 deletions

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'] );
}
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;
}