Opened 20 years ago
Closed 20 years ago
#507 closed defect (bug) (fixed)
Admin functions loaded after plugins
Reported by: | noderat | Owned by: | matt |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
The new functions to allow plugins to hook into the menu fail to work as stated because plugins are loaded fairly early on and are processed before admin-functions.php is included.
MooKitty proposed this solution for dealing with it in a plugin, but it should be fixed in Wordpress so that a nasty hack like this isn't required.
Adds the menu item
if ( ! function_exists( 'add_location_menu' ) ) {
function add_location_menu()
{
add_options_page(('Locations'), ('Edit Geo Info'), 5, 'lm.php');
}
} else {
$LM_is_loaded = TRUE;
}
add_action('admin_menu', 'add_location_menu');
if ( $LM_is_loaded ) :
?>
<div class="wrap">
<h2>Location Manager</h2>
</div>
<?php endif;
?>
Change History (3)
Note: See
TracTickets for help on using
tickets.
That's why we have is_plugin_page(), which is in functions.php. We will not load admin-functions.php before loading the plugins because plugins are loaded not just for the admin backend, but for the frontend of the weblog as well. Tagging admin-functions.php along will clutter the critical path.