functions.php
特定の固定ページ(home)のエディタを非表示
add_filter('use_block_editor_for_post',function($use_block_editor,$post){
if($post->post_type==='page'){
if(in_array($post->post_name,['home'])){
remove_post_type_support('page','editor');
return false;
}
}
return $use_block_editor;
},10,2);
特定の固定ページ(ID2)のみビジュアルエディタを使えないようにする
function my_admin_style() {
if ( ( $post = get_post() ) && ( $post->ID === 2 ) ) {
echo '<style>
body.wp-admin #postdivrich{
display:none;
}</style>';
}
}
add_action( 'admin_enqueue_scripts', 'my_admin_style' );
コメント