Posts, Post Types: Use an existing string for "Invalid post type" error message.
Props ramiy. Fixes #39171. git-svn-id: https://develop.svn.wordpress.org/trunk@39756 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
efefa1d05e
commit
26514215a7
@ -52,7 +52,7 @@ if ( ! current_user_can( 'upload_files' ) ) {
|
|||||||
if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
|
if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
|
||||||
$post = get_post( $id );
|
$post = get_post( $id );
|
||||||
if ( 'attachment' != $post->post_type )
|
if ( 'attachment' != $post->post_type )
|
||||||
wp_die( __( 'Unknown post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
if ( ! current_user_can( 'edit_post', $id ) )
|
if ( ! current_user_can( 'edit_post', $id ) )
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ case 'edit':
|
|||||||
wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
|
wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
|
||||||
|
|
||||||
if ( ! $post_type_object )
|
if ( ! $post_type_object )
|
||||||
wp_die( __( 'Unknown post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
|
|
||||||
if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
|
if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
|
||||||
@ -208,7 +208,7 @@ case 'trash':
|
|||||||
wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
|
wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
|
||||||
|
|
||||||
if ( ! $post_type_object )
|
if ( ! $post_type_object )
|
||||||
wp_die( __( 'Unknown post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
|
|
||||||
if ( ! current_user_can( 'delete_post', $post_id ) )
|
if ( ! current_user_can( 'delete_post', $post_id ) )
|
||||||
wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
|
wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
|
||||||
@ -231,7 +231,7 @@ case 'untrash':
|
|||||||
wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
|
wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
|
||||||
|
|
||||||
if ( ! $post_type_object )
|
if ( ! $post_type_object )
|
||||||
wp_die( __( 'Unknown post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
|
|
||||||
if ( ! current_user_can( 'delete_post', $post_id ) )
|
if ( ! current_user_can( 'delete_post', $post_id ) )
|
||||||
wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
|
wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
|
||||||
@ -249,7 +249,7 @@ case 'delete':
|
|||||||
wp_die( __( 'This item has already been deleted.' ) );
|
wp_die( __( 'This item has already been deleted.' ) );
|
||||||
|
|
||||||
if ( ! $post_type_object )
|
if ( ! $post_type_object )
|
||||||
wp_die( __( 'Unknown post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
|
|
||||||
if ( ! current_user_can( 'delete_post', $post_id ) )
|
if ( ! current_user_can( 'delete_post', $post_id ) )
|
||||||
wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
|
wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
|
||||||
|
@ -787,7 +787,7 @@ final class WP_Customize_Nav_Menus {
|
|||||||
*/
|
*/
|
||||||
public function insert_auto_draft_post( $postarr ) {
|
public function insert_auto_draft_post( $postarr ) {
|
||||||
if ( ! isset( $postarr['post_type'] ) || ! post_type_exists( $postarr['post_type'] ) ) {
|
if ( ! isset( $postarr['post_type'] ) || ! post_type_exists( $postarr['post_type'] ) ) {
|
||||||
return new WP_Error( 'unknown_post_type', __( 'Unknown post type' ) );
|
return new WP_Error( 'unknown_post_type', __( 'Invalid post type.' ) );
|
||||||
}
|
}
|
||||||
if ( empty( $postarr['post_title'] ) ) {
|
if ( empty( $postarr['post_title'] ) ) {
|
||||||
return new WP_Error( 'empty_title', __( 'Empty title' ) );
|
return new WP_Error( 'empty_title', __( 'Empty title' ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user