I want to make a menu button that takes me to wp-admin/widgets.php. The above code seems to work only partially.
add_action( 'admin_menu', 'register_widgets_menu_button' );
function register_widgets_menu_button(){
add_menu_page( 'Widgets', 'Widgets', 'manage_options', 'widgets', 'my_custom_menu_page', plugins_url( 'myplugin/images/icon.png' ), 6 );
}
function my_custom_menu_page(){
include ( 'widgets.php' );
I get to the widgets page, but in a peculiar way. Here is the URL that I see in the address bar:
wp-admin/admin.php?page=widgets
But there is a PHP error breaking the page (I can’t see all the widgets). Here is the error:
Notice: Undefined variable: wp_registered_sidebars in htdocs/wp-admin/widgets.php on line 403