WEBTODESIGN

WordPressで投稿画面の不要な項目を非表示にする

Gutenbergエディターの投稿画面にある、右サイドバーの不要な項目を非表示にするメモ。

エディターの様子

functions.phpに追記

functions.phpに以下の記述を追記します。

///// 投稿画面の不要な項目非表示 ////
add_action( 'init', 'remove_block_editor_options' );
function remove_block_editor_options() {
    remove_post_type_support( 'post', 'author' );// 投稿者
    remove_post_type_support( 'post', 'post-formats' );// 投稿フォーマット
    remove_post_type_support( 'post', 'revisions' );// リビジョン
    remove_post_type_support( 'post', 'thumbnail' );// アイキャッチ
    remove_post_type_support( 'post', 'excerpt' );// 抜粋
    remove_post_type_support( 'post', 'comments' );// コメント
    remove_post_type_support( 'post', 'trackbacks' );// トラックバック
    remove_post_type_support( 'post', 'custom-fields' );// カスタムフィールド
    unregister_taxonomy_for_object_type( 'category', 'post' ); // カテゴリー
    unregister_taxonomy_for_object_type( 'post_tag', 'post' ); // タグ
}

必要に応じて内容を足し引きしてください👍