[wp-trac] [WordPress Trac] #11007: plugin_basename() should allow to strip file extension

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 16 12:01:19 UTC 2011


#11007: plugin_basename() should allow to strip file extension
-------------------------+-----------------------------
 Reporter:  sirzooro     |       Owner:  westi
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Plugins      |     Version:  2.8.4
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+-----------------------------

Comment (by westi):

 Replying to [comment:3 sirzooro]:
 > I know about one case (wp-admin/admin.php:147):
 > `do_action('load-' . $page_hook);`
 >
 > In order to use it for my plugin's setting page I had to use following
 code:
 > {{{
 > add_action( 'load-settings_page_'.substr( plugin_basename( __FILE__ ),
 0, -4 ),
 >     array( &$this, 'load_settings_page' ) );
 > }}}

 Why can't you just do this:

 {{{
     $my_plugin_page_hook = add_options_page( ... );
     add_action( 'load-' . $my_plugin_page_hook , 'my_load_function' );
 }}}
 }}}

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


More information about the wp-trac mailing list