Promote WordPress Categories to a top-level menu item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('admin_menu', [$this, 'promoteCategories']); | |
/** | |
* Promote Categories to a top-level menu item | |
* | |
* @return void | |
*/ | |
public function promoteCategories() | |
{ | |
remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=category'); | |
add_menu_page('Categories', 'Categories', 'manage_categories', 'edit-tags.php?taxonomy=category', '', 'dashicons-category'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice snippet!
Worth mentioning for anyone wanting to use this, the code assumes you're inside a Class. If you're not, then 2 small changes:
add_action('admin_menu', [$this, 'promoteCategories']);
changes to
add_action('admin_menu', 'promoteCategories');
and then
public function promoteCategories()
changes to
function promoteCategories()