在检查当前用户是否为管理员时,我无法使用remove\\u shortcode,但我的最佳选择似乎是更改插件本身的这一行:
if ( current_user_can(\'edit_posts\') && current_user_can(\'edit_pages\') ) {
//do stuff
}
以下是其他人可能会看到的情况:
add_action(\'init\', \'add_button\');
function add_button() {
if ( current_user_can(\'edit_posts\') && current_user_can(\'edit_pages\') )
{
add_filter(\'mce_external_plugins\', \'add_plugin\');
add_filter(\'mce_buttons_3\', \'register_button\');
}
}
function register_button($buttons) {
array_push($buttons, "one-fourth", "one-fourth-last" ); //keep adding buttons as needed
return $buttons;
}
function add_plugin($plugin_array) {
$plugin_array[\'quote\'] = get_bloginfo(\'template_url\').\'/library/widgets/shortcode-support.js\'; //the javascript support for appending the short code to content box when clicking icon
return $plugin_array;
}