Last active
June 16, 2016 03:46
-
-
Save gurasa/169934c2469983c4e82a2bfe1b0342c1 to your computer and use it in GitHub Desktop.
WordPress の特定のカスタムページテンプレートだけ、管理画面でビジュアルエディタ(リッチエディタ)を非表示にする方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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