【WordPress】Gutenbergを無効化してクラシックエディターを有効化する

WordPressのGutenbergをプラグイン無しで無効化して、クラシックエディターへ変更する方法。

投稿ページ、固定ページ、カスタム投稿タイプにも対応している。

Webサイト全体で無効化する

functions.phpに下記のコードを追記する。

add_filter( 'use_block_editor_for_post', '__return_false' );

投稿ページ、固定ページで無効化する

functions.phpに下記のコードを追記する。

function disable_block_editor($use_block_editor, $post_type) {
//  if ($post_type === 'post') return false; // デフォルトの投稿で無効化
  if ($post_type === 'page') return false; // 固定ページで無効化
  return $use_block_editor;
}
add_filter('use_block_editor_for_post_type', 'disable_block_editor', 10, 10);

また、特定のユーザーで無効化、特定のスラッグで無効化など、細かな指定ができる。

参考: https://www.nxworld.net/wp-disable-gutenberg.html

Related Tags