Articles of add submenu page

How to create sub menu with a URL parameter?

I would like to add parameter for the submenus, but when I click to the admin page I receive the following message: You do not have sufficient permissions to access this page. Code: add_submenu_page( ‘sandbox’, ‘Sandbox Options’, ‘Options’, ‘administrator’, ‘sandbox_options&tab=4’, ‘sandbox_options_display’ ); Without &tab=4 everything is okay.

Change top level menu item to point to custom submenu item

I’m using a plugin called CMS Page Order (Now referred to as CPO) It’s pretty simple, the said plugin adds a new item to the submenu of every custom post type. The menu item leads to a page where you can reorder the posts of the certain post type. I’ve added so that you […]

How to change page via login as user and admin

I am using WordPress and I’m trying to develop eCommerce website using WooCommerce. When a user logs in I want to show the following in the menu-bar: Product Category Users profile Orders Cart Then, when a vendor or seller login, it will show: Vendor’s profile Dashboard Orders, Products Payment options How can I achieve this?

add_submenu_page() link missing 'admin.php?' prefix

I have two plugins – one is the “primary” plugin called “SmartPost” and I’m trying to extend it with another plugin called “SmartPost E-mails”. So, in other words, “SmartPost E-mails” extends and depends on “SmartPost” to exist and load before the e-mails plugin does. Within the SmartPost plugin, I have the following admin menu creation […]

add_submenu_page callback a file instead of a function?

I want to clean up my theme options because I can’t keep track of everything. How can I get my page_callback to link to a file sintead of a callback? I know that I could include the file in the callback but why if I can simply call the file here? add_submenu_page( null // -> […]

add_submenu_page set for multiple roles

This question already has an answer here: How to add more than 1 user role to sub-menu pages 1 answer

Hooking into add_submenu_page

Ever come across a plugin that is using the manage_options capability for a page that… really doesn’t need to be? Well, I’ve come across just that. This may be more of a general question about hooking into add_submenu_page, so not just specific to my use-case. I looked at add_dashboard_page which is simply a wrapper for […]

add_submenu_page not working

I have a built a plugin which creates a custom menu like this: add_menu_page( ‘Wholesale Pricing’, ‘Wholesale’, ‘manage_options’, ‘woo-wholesale’, ‘woo_wholesale_page_call’); I am now trying to add a subpage item underneath this. I have read the codex and came up with: add_submenu_page( ‘woo-wholesale’, ‘Registrations’, ‘Registrations’, ‘manage_options’, ‘woo-wholesale-registrations’, ‘wwpr_page_call’ ); I am guessing this is incorrect as […]

Add menu and submenu in admin with a URL instead of slug?

I use this function and hook: function mysite_admin_menu() { add_menu_page( ‘Categories’, ‘Cat√©gories’, ‘administrator’, ‘categories’, ‘a_function’ ); add_submenu_page( ‘categories’, ‘Manage’, ‘Manage’, ‘administrator’, ‘xxx’, ‘a_function’ ); remove_submenu_page(‘categories’,’categories’); } add_action( ‘admin_menu’, ‘mysite_admin_menu’ ); It displays what I need: a menu with a submenu on the left admin menu bar. The thing is, the submenu leads to this page: […]

Programmatically adding menu items function replicates in multiple menus

I have the following code: add_filter( ‘wp_nav_menu_objects’, ‘dynamically_add_shop_categories_to_submenu’ ); function dynamically_add_shop_categories_to_submenu( $items ) { $taxonomy_name = array( ‘shop-category’ ); $args = array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => true, ‘fields’ => ‘all’, ‘exclude’ => ‘160’, ); $terms = get_terms( $taxonomy_name, $args ); $base = ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/businesses/’; $bc = ‘&shop-category=’; $bt […]