固定ページで間違えて”ビジュアル”タブに切り替えてコーディングしたページが…
何度もそんな経験があります。
下記のコードをfunctions.phpにコピペすると、固定ページのみが ”ビジュアル” と ”テキスト” の切り替えタブが無くなり ”テキスト” 編集のみになります。
投稿やカスタム投稿タイプに関しましてはタブ切り替えが残っているのでとても便利です。
下記コードをfunctions.phpにコピペするだけでトラブル防止!!
functions.php
//固定ページではビジュアルエディタを利用できないようにする
function disable_visual_editor_in_page(){
global $typenow;
if( $typenow == 'page' ){
add_filter('user_can_richedit', 'disable_visual_editor_filter');
}
}
function disable_visual_editor_filter(){
return false;
}
add_action( 'load-post.php', 'disable_visual_editor_in_page' );
add_action( 'load-post-new.php', 'disable_visual_editor_in_page' );
add_filter('protected_title_format', 'remove_protected');
function remove_protected($title) {
return '%s';
}
fuctions.phpを編集する際はバックアップを必ずとってからにして下さいね!