2016/12/22
固定ページ
備忘録です。
固定ページの場合、ほとんどエンドクライアントさんが編集することがないので、できればビジュアルエディターを使ってほしくないなーと思っていましたが、固定ページだけビジュアルエディターを表示させない方法がありました。
参考サイト
【WordPress】固定ページの編集時にだけビジュアルエディターを使用不可能にする方法。
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');
応用編として、MW WP Formのビジュアルエディターを使用不可にすることもできます。
function disable_visual_editor_in_page() {
global $typenow;
if( $typenow == 'page' ){
add_filter('user_can_richedit', 'disable_visual_editor_filter');
}
//追加
if( $typenow == 'mw-wp-form' ){
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');
ビジュアルエディターを投稿も含めて全て使わないということなら、ユーザー画面で「ビジュアルリッチエディターを使用しない」にチェックを入れればOKですね。
2026/11/07
神社
2026/11/06
AI
2026/11/05
Wordpress
ホームページ制作
2026/11/04
Mac
2026/11/03
AI