[wp-trac] [WordPress Trac] #12596: "screen options" tab disappearing for plugins

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 15 18:32:09 UTC 2010


#12596: "screen options" tab disappearing for plugins
--------------------------+-------------------------------------------------
 Reporter:  arena         |       Owner:  westi            
     Type:  defect (bug)  |      Status:  new              
 Priority:  normal        |   Milestone:  3.0              
Component:  Plugins       |     Version:  3.0              
 Severity:  normal        |    Keywords:  reporter-feedback
--------------------------+-------------------------------------------------

Comment(by TobiasBg):

 > 'screen_meta-screen' worked in previous versions. set_current_screen()
 only exists since 3.0 ...

 Code changes... While the WP developers usually will do everything they
 can to maintain backwards compatibility, that is not always possible.
 Also, it should not be too hard to include a version check or a
 function_exists() check.

 > I tried to use set_current_screen() and called it on following hooks:

 As I said: Use the {{{load-$hook}}} action, where {{{$hook}}} is the
 result of

 {{{$hook = add_(sub)menu_page(...)}}}

 Calling it earlier (in init/admin_init) won't work, because that is before
 the actual call of {{{set_current_screen()}}} by WordPress, which then
 overrides your call again. Calling it later (admin_head) also won't work,
 because all the magic regarding the tab has been done by then, as the
 output of the page has already started.

 > and set_current_screen() is WEIRD !!!

 That may be true, but I'm pretty sure the original coder did the best he
 could to make it work effectively. While it can be argued that an
 additional in-between-step might make the code more readable, keep in mind
 that that part of the code is run pretty often (on every page load of the
 admin area) and therefore should be as quick as possible. And sometimes it
 is not always required to fully understand a function, just to be able to
 use it :-)

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


More information about the wp-trac mailing list