こんにちは、nishi_talk(@nishi_talk)です。
WordPressで管理画面のサイドメニューの順番を変更する方法をご紹介します。
管理画面の各項目
function.phpに並び順を記載します。
特定のカスタム投稿などの順番を変更する場合は「edit.php?post_type=投稿タイプ」の指定で対応可能です。
/*
* Admin メニュー
*/
// 順序変更
// ====================================== //
function custom_menu_order($menu_ord) {
if (!$menu_ord) return true;
return array(
'index.php', // ダッシュボード
'theme-general-settings', // テーマオプション(ACF)
'separator1', // 区切り線1
'edit.php', // 投稿
'edit.php?post_type=service', // サービス
'edit.php?post_type=blog', // Blog
'edit.php?post_type=news', // News
'edit.php?post_type=seminar', // セミナー
'edit.php?post_type=case', // 導入事例
'edit.php?post_type=page', // 固定ページ
'wpcf7', // コンタクトフォーム
'separator2', // 区切り線2
'edit-comments.php', // コメント
'upload.php', // メディア
'link-manager.php', // リンク
'users.php', // ユーザー
'separator3', // 区切り線3
'themes.php', // テーマ
'plugins.php', // プラグイン
'tools.php', // ツール
'options-general.php', // 設定
'separator-last', // 区切り線3
);
}
add_filter('custom_menu_order', 'custom_menu_order');
add_filter('menu_order', 'custom_menu_order');