[wp-trac] [WordPress Trac] #19055: Post type check on top of wp-admin/edit.php enhancement
WordPress Trac
wp-trac at lists.automattic.com
Wed Oct 26 10:04:49 UTC 2011
#19055: Post type check on top of wp-admin/edit.php enhancement
--------------------------+-----------------------------
Reporter: markoheijnen | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Post Types | Version:
Severity: normal | Keywords: dev-feedback
--------------------------+-----------------------------
I was looking into edit.php and I noticed that when you unregister post
type 'post' on a hacky way it never would return as an invalid post type.
I do know that this is just a little step to make unregistering a post
type easy.
I would say that:
{{{
if ( !isset($_GET['post_type']) )
$post_type = 'post';
elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' =>
true ) ) ) )
$post_type = $_GET['post_type'];
else
wp_die( __('Invalid post type') );
}}}
should be:
{{{
if ( !isset($_GET['post_type']) )
$_GET['post_type'] = 'post';
if ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true
) ) ) )
$post_type = $_GET['post_type'];
else
wp_die( __('Invalid post type') );
}}}
related: unregister_post_type() #14761
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19055>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list