[wp-trac] Re: [WordPress Trac] #6725: $page_hook should not be translated in localized wordpress versions

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 22 21:59:42 GMT 2008


#6725: $page_hook should not be translated in localized wordpress versions
--------------------------------------------------------------------+-------
 Reporter:  whoismanu                                               |        Owner:  anonymous
     Type:  defect                                                  |       Status:  closed   
 Priority:  normal                                                  |    Milestone:  2.7      
Component:  Administration                                          |      Version:  2.5      
 Severity:  normal                                                  |   Resolution:  wontfix  
 Keywords:  page_hook localization translation admin_print_scripts  |  
--------------------------------------------------------------------+-------
Changes (by whoismanu):

  * status:  new => closed
  * resolution:  => wontfix

Comment:

 ok, after a lot of searching and digging i finally found a proper way of
 doing this. apparently you should never hard code the page_hook part of
 the admin_print_scripts-page_hook hook. instead use return values that you
 get when adding menu pages. Example:


 {{{
 // Add a new menu under Manage
 $manage = add_management_page(__('Manage PhotoQ', 'PhotoQ'), 'PhotoQ', 8,
 'whoismanu-photoq.php', array(&$this, 'manage_page'));
 //use the return value as page_hook
 add_action('admin_print_scripts-' . $manage, array(&$this,
 'addHeaderCode'), 1);
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6725#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list