485 | | if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { |
486 | | if ( !current_user_can( 'edit_pages' ) ) |
487 | | return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) ); |
| 485 | if ( isset( $_POST['post_type'] ) ) { |
| 486 | $post_type_obj = get_post_type_object($_POST['post_type']); |
| 487 | if ( !current_user_can($post_type_obj->edit_type_cap) ) |
| 488 | return new WP_Error( $post_type_obj->edit_type_cap, sprintf(__( 'You are not allowed to create %s on this blog.'), $post_type_obj->label) ); |