我已经用user role editor创建了一个新的用户角色(基于shop manager),我需要为这个角色显示一个自定义插件。
谢谢
$user = wp_get_current_user();
if ( in_array( \'custom_role\', (array) $user->roles ) ) {
//The user has the "custom" role
add_action( \'some_menu\', \'my_plugin_menu\' );
}
function my_plugin_menu() { add_options_page(\'My Plugin Settings\', \'My Plugin\', \'manage_options\', \'my-plugin-settings\', \'my_plugin_admin_page\'); }