mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
Role/Capability: When checking capabilities before setting a post slug, ensure the correct post type capabilities are used.
Previously, only the `publish_posts` capability was checked. Now, the correct meta or primitive capability for the post type is used where appropriate. Props peterwilsoncc Fixes #42464 git-svn-id: https://develop.svn.wordpress.org/trunk@42380 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3304,8 +3304,16 @@ function wp_insert_post( $postarr, $wp_error = false ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Don't allow contributors to set the post slug for pending review posts.
|
||||
if ( 'pending' == $post_status && ! current_user_can( 'publish_posts' ) ) {
|
||||
/*
|
||||
* Don't allow contributors to set the post slug for pending review posts.
|
||||
*
|
||||
* For new posts check the primitive capability, for updates check the meta capability.
|
||||
*/
|
||||
$post_type_object = get_post_type_object( $post_type );
|
||||
|
||||
if ( ! $update && 'pending' === $post_status && ! current_user_can( $post_type_object->cap->publish_posts ) ) {
|
||||
$post_name = '';
|
||||
} elseif ( $update && 'pending' === $post_status && ! current_user_can( 'publish_post', $post_ID ) ) {
|
||||
$post_name = '';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user