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, $position ); ?> But I would like to add absolute path for menu option in the place of $menu_slug. please see the screen shot, I have created both ” … Read more

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: add_menu_page(‘Example’, ‘Example’, ‘activate_plugins’, ‘edit.php?post_type=example’, ‘render_table’, ‘dashicons-tickets’, 3); add_submenu_page ( ‘edit.php?post_type=example’, ‘All Examples’, ‘All Examples’, ‘activate_plugins’, ‘edit.php?post_type=example’); add_submenu_page ( ‘edit.php?post_type=example’, ‘Add … Read more

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 the Codex and multiple tutorials, this piece of code placed in the functions.php file should create a submenu of the ‘Appearence’ section … Read more

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 register_widgets_menu_button(){ add_menu_page( ‘Widgets’, ‘Widgets’, ‘manage_options’, ‘widgets’, ‘my_custom_menu_page’, plugins_url( ‘myplugin/images/icon.png’ ), 6 ); } function my_custom_menu_page(){ include ( ‘widgets.php’ ); I get to the widgets page, but in a peculiar way. … Read more

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, ‘onixion_main_page’ ),’dashicons-chart- area’,’200′); add_submenu_page( ‘onixion-admin-menu’, ‘scripts’, ‘Scripts’, ‘manage_options’, ‘scripts’, array(&$this, ‘onixion_scripts_page’ ) ); add_submenu_page( ‘onixion-admin-menu’, ‘custom_footer’, ‘Custom Footer’, ‘manage_options’, ‘custom_footer’, array(&$this, ‘onixion_custom_footer_page’ ) ); add_submenu_page( ‘onixion-admin-menu’, ‘file_upload’, ‘File Upload’, ‘manage_options’, ‘file_upload’, array(&$this, ‘onixion_file_upload_page’ ) ); add_submenu_page( ‘onixion-admin-menu’, ‘payments’, ‘Payments’, ‘manage_options’, ‘payments’, … Read more

add_menu_page with no link

I wanted to create an admin menu in WordPress that does not go to a page when you click it. The Menu would be as follows. Members <– Top Level View Members Add Members “Members”, the top level menu, would not link to anywhere. It just holds the other menu items. The reason WHY, is … Read more

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 register_post_type()‘s show_in_menu option. I also created a plugin settings page using add_submenu_page(), which I also added to the top menu. … Read more

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’ ); Now I want to load a js file only on this page. I’m trying to do so properly by enqueueing it only on my new page: function nonpareil_options_js_enqueue($hook_suffix) { if( ‘nonpareil_theme_options’ != $hook_suffix ) return; wp_enqueue_script( ‘nonpareil-options’, … Read more

add_menu_page() with function inside a class [duplicate]

This question already has answers here: Registering Class methods as hook callbacks (2 answers) Closed 3 years ago. 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, inside one of my … Read more