WordPress Quicky: Register Sidebar Widget with 3.0
Another quicktipp for wordpress plugin developers. Registering a sidebar widget can end with a fatal error if you use the code from the wordpress documentation …
Don’t call the register_widget direct, it will cause a PHP Fatal error: Call to a member function register() on a non-object in ../wp-includes/widgets.php … instead use following line of code:
add_action( 'widgets_init', create_function('', 'return register_widget("MyWidgetClass");') ); |