您应该在URL中查找帖子类型或帖子本身的类型,您可以更具体一些,只为管理员会话运行代码
// Remove WYSIWYG Editor
function remove_wysiwyg( $hook ) {
global $post;
global $pagenow;
if ( $pagenow== \'post-new.php\' && isset($_GET[\'post_type\'])) || // if a new post page check the post type from the URL
(($pagenow== \'post.php\' ) && // If editing existing post check the post type of the post
(($post->post_type != \'post\') && ($post->post_type != \'page\')))
add_filter(\'user_can_richedit\', \'__return_false\');
}
add_action( \'admin_init\', \'remove_wysiwyg\' );