[wpmu-trac] [WordPress MU Trac] #1044: add_options_page() not working properly
WordPress MU Trac
wpmu-trac at lists.automattic.com
Tue Jul 14 04:05:52 UTC 2009
#1044: add_options_page() not working properly
----------------------------+-----------------------------------------------
Reporter: SergeyBiryukov | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Administration | Version: 2.8.1
Severity: normal | Keywords: admin, options
----------------------------+-----------------------------------------------
There is a misprint in `/wp-admin/menu-header.php` which prevents
{{{add_options_page()}}} from working properly without the last [function]
parameter, which is optional.
As described on http://mu.wordpress.org/forums/topic/13329, when you want
to include a option page like:
{{{
add_options_page('MyPlugin', 'MyPluginSettings', 10, 'myplugin/myplugin-
options.php');
}}}
it returns the following link in the admin area:
{{{
http://mydomain.com/wp-admin/myplugin/myplugin-options.php
}}}
which should be:
{{{
http://mydomain.com/wp-admin/options-general.php?page=wp-myplugin
/myplugin-options.php
}}}
To correct this, the line 134 needs to be edited:
{{{
if ( ( ('index.php' != $sub_item[2]) && ( file_exists(WP_PLUGIN_DIR .
"/$menu_file") || file_exists( WPMU_PLUGIN_DIR . "/$menu_file") ) ) || !
empty($menu_hook) ) {
}}}
It should be `$sub_file` instead of `$menu_file`:
{{{
if ( ( ('index.php' != $sub_item[2]) && ( file_exists(WP_PLUGIN_DIR .
"/$sub_file") || file_exists( WPMU_PLUGIN_DIR . "/$sub_file") ) ) || !
empty($menu_hook) ) {
}}}
--
Ticket URL: <http://trac.mu.wordpress.org/ticket/1044>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser
More information about the wpmu-trac
mailing list