The code creates a new page under the admin menu called “Category List”. When an administrator clicks on this menu, the list of categories (as defined by the wp_list_categories function) will be displayed on this page. This WordPress customization is especially useful when managing large WordPress sites with many categories.
function ts_my_custom_admin_page() { // Define the arguments for wp_list_categories $args = array( 'child_of' => 0, 'current_category' => 0, 'depth' => 0, 'echo' => 0, // Change to 0 to return the list instead of echoing it 'exclude' => '', 'exclude_tree' => '', 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'hide_empty' => 0, 'hide_title_if_empty' => false, 'hierarchical' => true, 'order' => 'ASC', 'orderby' => 'name', 'separator' => '<br />', 'show_count' => 0, 'show_option_all' => '', 'show_option_none' => __( 'No categories' ), 'style' => 'list', 'taxonomy' => 'category', 'title_li' => __( 'Categories' ), 'use_desc_for_title' => 1, ); // Fetch the category list $categories = wp_list_categories($args); ?> <div class="wrap"> <h1>Category List</h1> <pre> <?php // Print out the categories list echo $categories; ?> </pre> </div> <?php } add_action('admin_menu', function() { add_menu_page('Category List', 'Category List', 'manage_options', 'my-custom-category-page', 'ts_my_custom_admin_page'); });