Remove custom post type from the auto generated list on the edit menu page Add menu items
As documented, when using register_post_type() set show_in_nav_menus to false.
As documented, when using register_post_type() set show_in_nav_menus to false.
Try something like this: in the load hook, you can ouput your xml code. u function my_menu_pages() { $hook = add_submenu_page( null, ‘Page Title’, ‘Page Title’, ‘administrator’, ‘sub-menu-slug’, function() { } ); add_action(‘load-‘ . $hook, function() { // add your xml code here, // you will get a blank page to start with exit; }); … Read more
Remove menu pages only for non admin
That’s not how you add submenus to the appearance menu, or how you create settings pages for themes. Adding a submenu involves either add_submenu_page which lets you add submenus to any menu item, or the helper function add_theme_page which is for the appearance menu. Here’s one of the examples from the official documentation: function add_test_theme_page() … Read more
You would need to create a custom post type by adding this code to your functions.php file (only do this if you are comfortable with editing theme files if not you should use a plugin such as “Custom Post Type UI”): function custom_post_type() { $labels = array( ‘name’ => ‘Articles’, ‘singular_name’ => ‘Article’, ‘add_new’ => … Read more
Is there a way to achieve this type of Left dashboard Admin menu without using a plugin? You have to put the code somewhere. That is either going to be a plugin, a must-use plugin, or a theme. A theme is a somewhat strange place to be putting code intended for the backend, so the … Read more
I don’t think you can remove it globally, maybe with traversing the global $menu array. But you can unset each individually: add_action( ‘admin_menu’, ‘Wps_remove_tools’, 99 ); function Wps_remove_tools(){ remove_menu_page( ‘index.php’ ); //dashboard remove_menu_page( ‘edit.php’ ); //posts remove_menu_page( ‘upload.php’ ); //media remove_menu_page( ‘link-manager.php’ ); //links remove_menu_page( ‘edit.php?post_type=page’ ); //page remove_menu_page( ‘edit-comments.php’ ); //comments remove_menu_page( ‘themes.php’ ); … Read more
Sounds to me like the hooked function that calls the page file itself is the same for all five uses of add_submenu_page(). Hard to tell without the code. <?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); ?> The $function variable should be different for all five uses meaning you need another four function or … Read more
In your construct function you also need to enqueue a custom stylesheet that will house the CSS to style up your theme options. A simplified example would look like this: function admin_style() { wp_enqueue_style( ‘theme-options-style’, get_template_directory_uri().’styles/theme-options-style.css’); } add_action(‘admin_enqueue_scripts’, ‘admin_style’);
WordPress has some functions to help work with lists of objects. These are especially helpful when working with the nav menu objects or the query object. wp_filter_object_list() takes an array of objects and filters them by a given set of criteria. You get a result that only contains objects that match your criteria. Once you … Read more