[wp-trac] [WordPress Trac] #19353: WP_Screen::get tramples screen ids

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 28 18:55:44 UTC 2011


#19353: WP_Screen::get tramples screen ids
----------------------------------------+-----------------------
 Reporter:  batmoo                      |       Owner:  nacin
     Type:  defect (bug)                |      Status:  accepted
 Priority:  high                        |   Milestone:  3.3
Component:  Administration              |     Version:  3.3
 Severity:  major                       |  Resolution:
 Keywords:  has-patch needs-unit-tests  |
----------------------------------------+-----------------------
Changes (by nacin):

 * keywords:  has-patch => has-patch needs-unit-tests


Comment:

 If a post type starts with 'edit-', it will be caught by the initial meta
 boxes block. post_type_exists( $hookname ) is valid and accounted for.

 If a taxonomy starts with 'edit-', it will end up needing to be passed to
 convert_to_screen() as edit-edit-*. taxonomy_exists( $hookname ) is not
 valid — taxonomy_exists( 'edit-' . $hookname ) is.

 Post types that end with -add or -new will be caught with the initial
 check. A taxonomy that ends with -add or -new *will* break. I think this
 is fixable by also confirming that `( 'edit-' != substr( $id, 0, 5 ) || !
 taxonomy_exists( substr( $id, 5 ) ) )`. Remember, a taxonomy hook will
 need to start with 'edit-'.

 Unit tests for these edge cases would be nice. These changes passed all
 existing tests.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19353#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list