mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +00:00
Remove the ability to view the post listing screen and post editing screen for post types with show_ui set to false. It is unexpected and unintended behaviour that this is allowed.
If your plugin or site does rely on this behaviour, the arguments that are passed to `register_post_type()` should be altered so that `show_ui` is `true`, and arguments such as `show_in_menu`, `show_in_nav_menus`, and `show_in_admin_bar` are `false`. Fixes #33763 Props swissspidy, johnbillion git-svn-id: https://develop.svn.wordpress.org/trunk@34177 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -12,6 +12,10 @@ require_once( dirname( __FILE__ ) . '/admin.php' );
|
||||
if ( ! $typenow )
|
||||
wp_die( __( 'Invalid post type' ) );
|
||||
|
||||
if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
|
||||
wp_die( __( 'You are not allowed to edit posts in this post type.' ) );
|
||||
}
|
||||
|
||||
if ( 'attachment' === $typenow ) {
|
||||
if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user