如果遵循链接的教程,请查看注册按钮的函数:
function mylink_button() {
if ( ! current_user_can(\'edit_posts\') && ! current_user_can(\'edit_pages\'){
return;
}
if ( get_user_option(\'rich_editing\') == \'true\' ) {
add_filter( \'mce_external_plugins\', \'add_plugin\' );
add_filter( \'mce_buttons\', \'register_button\' );
}
}
您可以稍微更改它以检查帖子类型:
function mylink_button() {
if ( ! current_user_can(\'edit_posts\') && ! current_user_can(\'edit_pages\')){
return;
}
if ( get_user_option(\'rich_editing\') == \'true\' ) {
global $typenow;
if (empty($typenow) && !empty($_GET[\'post\'])) {
$post = get_post($_GET[\'post\']);
$typenow = $post->post_type;
}
if ("newpages" == $typenow){
add_filter( \'mce_external_plugins\', \'add_plugin\' );
add_filter( \'mce_buttons\', \'register_button\' );
}
}
}
这样,您只需注册“newpages”类型上的按钮