Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-admin/post-new.php.

props ericlewis, kraftbj, lukecarbis, mrmist.
fixes #33675. see #14530.

git-svn-id: https://develop.svn.wordpress.org/trunk@33864 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-09-02 18:35:05 +00:00
parent 2dcbf39e2d
commit 89fca37568

View File

@ -54,8 +54,13 @@ $title = $post_type_object->labels->add_new_item;
$editing = true;
if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) )
wp_die( __( 'Cheatin’ uh?' ), 403 );
if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) {
wp_die(
'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
'<p>' . __( 'You are not allowed to create posts as this user.' ) . '</p>',
403
);
}
// Schedule auto-draft cleanup
if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )