Opened 16 years ago
Closed 16 years ago
#9349 closed defect (bug) (fixed)
Load widgets.php Before Plugins Because Of New WP_Widget Class
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | high |
Severity: | normal | Version: | 2.8 |
Component: | Widgets | Keywords: | widgets |
Focuses: | Cc: |
Description
widgets.php is only included when wp_maybe_load_widgets() is called in /wp-includes/functions.php.
function wp_maybe_load_widgets() { if ( !function_exists( 'dynamic_sidebar' ) ) { require_once( ABSPATH . WPINC . '/widgets.php' ); add_action( '_admin_menu', 'wp_widgets_add_menu' ); } }
But in WP2.8 there is a new WP_Widget Class, if I attempt to create a new Widget Class extending on this class in my plugin, it will prompt me "Class 'WP_Widget' not found" because the class is not included before the plugin.
Should we load widgets.php in wp-settings.php? Or we should move the class portion to new file called class-widgets.php?
Change History (2)
Note: See
TracTickets for help on using
tickets.
I'm thinking we should always load the API and make the default widgets conditional.