您需要使用wp_enqueue_style
把它挂在admin_print_styles
add_action( \'admin_print_styles\' , \'my_wp_admin_css\' );
function my_wp_admin_css() {
wp_enqueue_style(\'my_admin_style\' , WP_PLUGIN_URL . \'/myPlugin/stylesheet.css\' );
}
如果您只想在插件页面上显示样式表,可以使用:
$mypage = add_management_page( \'myplugin\', \'myplugin\', 9, __FILE__, \'myplugin_admin_page\' );
add_action( "admin_print_styles-$mypage", \'myplugin_admin_head\' );
function myplugin_admin_head() {
// what your plugin needs in its <head>
}