Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress の特定のカスタムページテンプレートだけ、管理画面でビジュアルエディタ(リッチエディタ)を非表示にする方法
<?php
// 特定のカスタムページテンプレートだけ、管理画面でビジュアルエディタ(リッチエディタ)を非表示
function disable_visual_editor_in_page_template(){
global $typenow;
$template_name = basename( get_page_template_slug( $_GET['post'] ), '.php' );
if( $typenow == 'page' and $template_name == 'TEMPLATE_NAME' ){
add_filter('user_can_richedit', create_function('' , 'return false;') );
}
}
add_action( 'load-post.php', 'disable_visual_editor_in_page_template' );
add_action( 'load-post-new.php', 'disable_visual_editor_in_page_template' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment