Questions tagged [add-menu-page]

Add a top level menu page.

Filter by
Sorted by
Tagged with
81
votes
3answers
63k views

add_menu_page() with different name for first submenu item

The add_menu_page documentation says to pass the menu title as the second parameter: add_menu_page('Page Title', 'Menu Title', ...); When adding more pages later via add_submenu_page, the main page ...
11
votes
2answers
9k views

do_shortcode() within Admin Page

I'm using a few plugins that have shortcodes ... however, instead of creating a public page for the content, I've created some new pages within the admin using add_menu_page and I need to know how to ...
5
votes
2answers
16k views

Show Custom Taxonomy Inside Custom Menu

I have a custom menu using add_menu_page: add_menu_page('My menu' , 'Some text', 'read', 'nwcm'); Under it, I show a custom post type menu item; // Create the news custom post type ...
5
votes
2answers
7k views

add_menu_page permissions - what am I doing wrong?

I am running a fresh install of Wordpress 3.3.2 and the only plugin enabled is one I'm developing, but I can't seem to get past a permissions issue in add_menu_page. With the exception of using ...
5
votes
2answers
11k views

Add custom page link with anchor

In my admin section I would like to add in Appearance > Menus > some custom pages to add to my menu. I have two different menu one for the home page and one for the others pages. In my home page menu ...
4
votes
3answers
5k views

How to remove duplicate link from add_menu_page

In the theme admin menu below, the "MyTheme Menu Label" is being duplicated twice on the sidebar menu, once for the main menu link and again for the first submenu link. How can I remove the 2nd ...
4
votes
1answer
827 views

What is the use of $page_title and how to use it?

I'm developing a WordPress plugin and added add_menu_page() but not sure what is the use of first parameter $page_title. If this is to use to display page title on the plugin page then how can I do ...
3
votes
2answers
10k views

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 ...
3
votes
3answers
9k views

How to use a WordPress' existing admin icon?

I use the add_menu_page function to add an new admin menu: add_menu_page( 'Custom_menu', 'Custom_menu', 'edit_posts', 'custom_slug', '', 'wordpress_existing_icon', 5 ); ...
3
votes
1answer
6k views

Generate Advanced Custom Fields box in custom admin menu page

I have created an custom admin menu page called FCC Youtube with add_menu_page function which has some custom fields I manually generated via HTML and PHP: code ( just the part how I created this ...
3
votes
1answer
921 views

Add highlighting to new Admin Dashboard Menu Item

I have implemented a Custom menu item in my wordpress dashboard using the following command in the functions.php function create_menu() { $settings_page = add_menu_page('Edit_Post_69', '...
3
votes
1answer
2k views

How to add a sub menu with AJAX?

What i want to do is fire up the add_submenu_page() function from within ajax on my plugin options page. When i click an "Add League" link, i want to display an ajax input[text] that will save into ...
3
votes
1answer
1k views

difference between add_object_page and add_menu_page

According to Codex, the add_object_page "essentially does the exact same thing as add_menu_page() in case you're wondering". So.... what is the difference between those two functions?
3
votes
0answers
807 views

How to change menu page capability

Is it possible to change the capability set for a menu page, previously added with add_menu_page()? I have a third plugin installed, that set a menu page created with a 'manage_options' capability, ...
2
votes
5answers
2k views

How to prevent parent admin page from appearring as a child admin page

I am using this code: add_menu_page($page_title, $menu_title, $this->capability, $menu_slug, $function); Which is adding top level admin page. When I add: add_submenu_page( $menu_slug, 'sub menu ...
2
votes
2answers
2k views

Adding an admin page - OOP approach not working

I have a parent class, which contains the following: use app\My_Dashboard; class My_Class { public function __construct() { add_action('admin_menu', array($this, 'setup_dashboard_page'));...
2
votes
1answer
185 views

Settings page above CPT page in admin section

I'm creating a plugin which generates a handfull or custom post types (CPT). I've create a top level menu in the admin left sidebar using add_menu_page(). I then added all CPTs to this menu using ...
2
votes
1answer
4k views

Theme Options page not showing up in admin menu

I'm currently developing a WordPress theme and would like it to have a preferences pane in order to specify the user's Google Analytics tracking code for example. Following the instructions I got on ...
2
votes
1answer
47 views

How to avoid creating first submenu page that is same as menu page?

I've created menu page and four submenu pages. public function onixion_admin_menu_option() { add_menu_page('onixion','Onixion','manage_options','onixion-admin- menu',array(&$this, '...
2
votes
0answers
490 views

Why add_menu_page adds admin.php and how to remove it?

I'm trying to add custom menu items for my Custom Post Type. I've added "show_in_menu" => false in my CPT definition so it will not show in admin menu. Then I've added to admin_menu action: ...
1
vote
2answers
2k views

Admin Menus - Name Menu different from first Submenu [duplicate]

I am creating a submenu with the following code: add_action( 'admin_menu', 'jp_create_admin_pages' ); function jp_create_admin_pages() { add_menu_page( 'Members', 'Members', ...
1
vote
2answers
1k views

Where is the submitted $_POST array stored after an option page submission?

What happens, when I click Save Changes on a option page, which was created by add_menu_page()? Where is the submitted data stored before the database transmission? A print_r($_REQUEST) returns only ...
1
vote
1answer
1k views

add_menu_page() with function inside a class [duplicate]

I'm an experienced dev, but new to WordPress. I'm following along with a course on udemy and they suggested I encapsulate my plugin functions in a class to help avoid namespace conflicts. However, ...
1
vote
2answers
343 views

Hiding Admin Page While Keeping Menu Expanded

I am creating a custom admin section. I have the following code: // Top level menu add_menu_page('Books', 'Books', 'publish_posts', 'books', 'render_books_page', '', 17); // Adding this function to ...
1
vote
1answer
633 views

Associating custom submenu item with post type of top level menu item

I'm working on a plugin that sets admin menu submenu pages on all different post types. I need to be able to associate these new submenu pages with the corresponding post type of the top level menu ...
1
vote
1answer
1k views

add_menu_page() for more than one user role

If I add a custom page to the wordpress backend menu via add_menu_page('My Custom Page', 'My Custom page', 'editor', 'custom_page','add_custom_page','dashicons-admin-comments',8); only a user with ...
1
vote
2answers
112 views

Wp menu add page link as custom empty link

i've a problem with wp menu, in the admin panel when i try to add a new page link to menu it creates a custom empty link instead, everything was working fine until i installed qtransalte X, when i ...
1
vote
2answers
498 views

Enqueueing Scripts on a Custom Top-level Menu Page

I've created a menu page using the following function: add_menu_page( 'Nonpareil options', 'Nonpareil options', 'administrator', 'nonpareil_theme_options', 'nonpareil_theme_display' ); ...
1
vote
1answer
1k views

How to add custom menu item on plugin activation?

When my plugin is activated, I would like to add a new menu item. Here is my code: class My_Plugin { function __construct() { register_activation_hook(__FILE__, array($this, 'install')); } ...
1
vote
1answer
37 views

Determine Registered Admin Menus

Is it possible to obtain a list of which Top Level Admin Menus have been registered via some plugin? I'm talking about menus registered with: add_menu_page();
1
vote
2answers
658 views

Return value of add_menu_page

I've read this on codex and seem some themes use it but never understood how it worked. (string) $hookname used internally to track menu page callbacks for outputting the page inside the global $...
1
vote
1answer
237 views

Adding subdomain to home_url for “add_menu_page”

I am trying to add a Wordpress admin menu item that will point to a URL which is http://docs.[currentdomain] My plugin code is currently: function user_manual() { add_menu_page( __( '...
1
vote
1answer
116 views

add_page_menu to make shortcut to widgets

I want to make a menu button that takes me to wp-admin/widgets.php. The above code seems to work only partially. add_action( 'admin_menu', 'register_widgets_menu_button' ); function ...
1
vote
1answer
56 views

how to open page, defined in plugin, from dashboad widget

I have a plugin that adds a number of admin pages, and drives two page templates for the public facing documents. It also loads one dashboard widget for "subscribers". In this widget is a list of ...
1
vote
1answer
979 views

add_submenu_page function to show videos table

wondering if its possible to show the attachments admin list for videos by using a custom menu link? Any pointers welcome! D. add_action('admin_menu', 'mt_add_pages'); function mt_add_pages() { ...
1
vote
1answer
201 views

Master menu item for multiple plugins?

I guess this question is more or less about aesthetics and organization rather than functionality, but I'm curious nonetheless... I know I can add a custom menu item in the dashboard for my plugin ...
1
vote
1answer
23 views

Add_menu_page not displaying the menu in class based plugin

class Cosmo_Games { public function __construct() { add_action('admin_menu', array($this, 'create_plugin_settings_page')); } public function create_plugin_settings_page() { $...
1
vote
0answers
34 views

add_menu_page the children get url encoded prefix

Here i create the pages: add_action("admin_menu", "wpa_create_plugin_pages"); function wpa_create_plugin_pages() { //Add submenu to Users $wpa_profile = "wpa_user_profile_settings";//parent ...
1
vote
1answer
29 views

Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?

I'm encountering funny behaviour with a custom post of mine that I'm working with in a plugin of mine. Here are the arguments of the custom post: array( 'label' => [omitted], 'labels' =>...
1
vote
0answers
40 views

Is there documentation reference for forms in menu and setting pages?

Trying to stick to WordPress best practices and improving how I do plugin development I have searched through the codex and developer documentation to see if there is anything indicating what is ...
1
vote
1answer
555 views

How to add tags in Submenu page or Menu page

Is it possible to add tags(Like every post) in Submenu page or Menu page? Without creating custom post type. I have Menu page and a form in it and I want to add tags in menu page.
1
vote
0answers
173 views

Admin Dashboard with Custom Tab for Client

I am trying to create a basic Tour Date widget. When the user clicks on the Tour Date Tab from the admin dashboard I want them to be presented with five fields. Date Venue City, State or Country ...
1
vote
1answer
511 views

Pagination in plugin's backend

I am displaying a list of posts in the plugin backend but I can't seem to get the pagination to work. I used the standard approach of getting the "paged" variable and then passing it to get_posts()'s ...
1
vote
1answer
626 views

Is there any way to add absolute path for add_menu_page function?

I am creating a plugin for add menu option to WordPress admin and using below function for that: <?php add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $...
1
vote
2answers
1k views

Add_menu_page() error message -> “You do not have sufficient permissions to access this page”

I'm currently building a website for a friend and have assigned him the user role of editor. I don't want to give him an administrator role in case he breaks the layout. Anyway, I am using '...
1
vote
0answers
151 views

How can I highlight a top level dashboard menu item created for a custom taxonomy?

I've used add_menu_page() to create a top-level dashboard menu item for a custom taxonomy. This is due to some specific needs with respect to this plugin. The menu item works fine, but when you ...
0
votes
2answers
2k views

How to point “add_menu_page” to HTML file rather than PHP function

I added a new menu item for my plugin like this: add_menu_page( 'Control Panel', 'My Plugin', 'manage_options', 'control-panel', array($this, 'control_panel_page'), plugins_url('/images/...
0
votes
1answer
619 views

why add_menu_page use simple function as arg while add_meta_box a call back?

I was looking on Wordpress function reference and find that add_menu_page takes simple function as arg while add_meta_box call it as call back. I am new to programming.. help me understand this
0
votes
1answer
79 views

How is a widget supposed to reference what is added to custom submenu or addmenu fields?

Stepping into advanced plugin development I've been following along with the Plugin Handbook but I did not see it mentioned how you're to reference what has been added to the settings page. So for ...
0
votes
1answer
118 views

Wordpress custom plugin gives error

I added submenu and admin pages on wordpress custom plugin. But it gives an error. Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wstock_variation' not found or ...