mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01: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 Built from https://develop.svn.wordpress.org/trunk@42380 git-svn-id: http://core.svn.wordpress.org/trunk@42209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dbd8923458
commit
ee51200c50
@ -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 = '';
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.0-alpha-42379';
|
||||
$wp_version = '5.0-alpha-42380';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user