I am trying to add a Menu in WordPress Admin Panel. I am using below code. This code is working. add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'weathers', [$this, 'weathers']); But below code is not working. I am facing error Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'edit.php?post_type=weather' not found or invalid function name . add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'weathers', 'edit.php?post_type=weather');
I am learning Plugin Development. My sub menu code is like below. add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'edit.php?post_type=weather'); But my menu is not kept open after click. Below screenshot is after click on Weathers.
Adding sub menus is easy with add_submenu_page and is working fine as long if you define a $parent_slug: add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); if you set the $parent_slug to NULL as described here to hide it from any menu item the title of the page will get ignored ($page_title) add_submenu_page( NULL, $page_title, $menu_title, $capability, $menu_slug, $function ); I've tested it with all versions from 3.3 up to the latest 4.0
I have added to my-plugin submenu a custom view of the user list using users.php and a my_plugin_view argument to filter the request: add_submenu_page( "my-plugin", 'Subscribers', 'Subscribers', 'edit_users', 'users.php?my_plugin_view=subscribers' ); When /users.php?my_plugin_view=subscribers is open the admin sidebar toggle Users > All Users instead of My Plugin > Subscribers I have tried: if( isset($_GET['my_plugin_view']) ){ remove_submenu_page( 'users.php' ); } but this removes the All Users section from the sidebar and doesn't toggle the plugin menu as expected. How to keep the …
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 becomes the first entry in the submenu: However, I want the first item in the list to have a different name (but still point to the same page), the way Wordpress itself does it: How could I accomplish that in my plugin?
How can I ensure that the data saved by an Advanced Custom Fields Relationship field, when on an Options page for a Post type, is separate? Detail below: I have an ACF field group, “Features”, containing a Relationship field. It is intended to allow me to pre-set some featured posts for a couple of custom post types – “Reports” and “Articles”. For those post types, in the same code that registers each post type, I have created an Options sub-page …
Was called incorrectly. The seventh parameter passed to an add_submenu_page() should be an integer representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.) in /home3/prombooking/listandlink.com/wp-includes/functions.php on line 4986
Context I'm making a big plugin with a complex architecture. I would like in my plugin architecture split pages and menus building on admin side. So I have these classes : Menu.php, Submenu.php and Page.php, SubPage.php I would like, when the administrator clik on menu/submenu links, it runs a common function callback inside Menu.php and Submenu.php which load only the right page or subpage thanks $_GET['page']. Problem Each submenu link does not bind a subpage anymore. All href of submenu …
I have created a plugin that has some sub menus i.e add new & list, besides that I also have pages to update the data, But I don't want to display these sub menus in dropdown. Here is my code. add_submenu_page( "testimonial", "Manage Testimonial", "Manage Testimonial", "manage_options", "manage-testimonial", "manage_testimonial" ); add_submenu_page( "testimonial", null, null, "manage_options", "edit-testimonial", "edit_testimonial" ); If I use this it adds blank ul for these, How can I do this. This is the admin panel drop down.
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 functions: class sp_admin{ add_action( 'admin_menu', array('sp_admin', 'sp_admin_add_template_page') ); add_action( 'admin_menu', array('sp_admin', 'sp_admin_add_category_page') ); function sp_admin_add_template_page() { add_menu_page( SP_PLUGIN_NAME, SP_PLUGIN_NAME, 'edit_dashboard', 'smartpost', array('sp_admin', 'sp_template_page'), null, null …
I've created this page: function wpdocs_register_my_setting() { add_submenu_page( 'edit.php?post_type=task', 'View Tasks', 'View Tasks', 'manage_options', 'view-tasks', 'view_tasks_submenu_page_callback' ); } function view_tasks_submenu_page_callback() { // html } add_action( 'admin_menu', 'wpdocs_register_my_setting' ); And I want to add a meta box to this page only. function cd_meta_box_add() { add_meta_box( 'in-progress-metabox', 'In Progress', 'render_task_in_progress_metabox', 'task', 'normal', 'high' ); } function render_task_in_progress_metabox() { // html } add_action( 'add_meta_boxes', 'cd_meta_box_add' ); But I cannot seem to find the correct answer for this. Again, I only want to add …
Starting to build my first plugin and I'm completely puzzled on why the submenu page won't show? The main page shows up, not the subpage. I've run over the syntax what feels like a million times and I just don't see the gap on what I have here. (Page markup is complete, not shown, I'm just trying to get the menu item to show up.) /* Create Menu Item */ function core_settings_menu() { add_menu_page( 'Core Settings & Code Manager', 'Core …
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 make the first submenu have a different name than the main menu // Details: https://wordpress.stackexchange.com/questions/66498/add-menu-page-with-different-name-for-first-submenu-item add_submenu_page('Books', 'Books', 'All Books', 'publish_posts', 'books', 'render_books_page'); // The Add Book menu page add_submenu_page('Books', 'Add New Book', 'Add Book', 'publish_posts', 'add-book', 'render_add_book_page'); // The Edit Book menu page (this page is hidden from the menu, and accessed …
*I have moved a custom post taxonomy to another menu item //created a post type that does not appear in admin menu, therefore its taxonomy does not, too $args = array( 'label' => 'Item', 'description' => 'Store items', 'labels' => $labels, 'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'revisions' ), 'taxonomies' => array( 'store-category' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => false, 'menu_position' => 5, 'menu_icon' => 'dashicons-cart', 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' …
I can't display the submenu of my menu when creating a plugin (Beginner). Could you please help me to find my error? My plugin is well activated and the menu_page appears well add_action('admin_menu','tictac_admin_menu_option'); function tictac_admin_menu_option() { add_menu_page( 'Gestion des Horaires', 'Time Control', 'manage_options', 'tictac_admin_menu', 'tictac_scripts_page', //plugins_url( 'time-control/admin/logo/tictac-logo.png' ), 'dashicons-calendar-alt' //16 ); add_submenu_page('tictac_admin_menu', 'Sous menu Opening', 'Options Opening', 'tictac_admin_submenu', 'tictac_scripts_menu', 'tictac_opening_submenu' ); } function tictac_opening_submenu() { ?> <div id="wrap"> <h1>Add Opening</h1> </div> <?php }
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.
I am currently creating an administrator plugin to manage and edit a large amount of separate information about establishments. I recreated a page with the list of articles which is linked to a new table in the database. Now I want to create a fully custom page of the same type as post-new.php - without the left menu and the top wordpress menu bar. add_submenu_page( 'a-list', 'Add ', 'Add','manage_options', 'asso-add','atv_a_add'); function atv_a_add(){ include plugin_dir_path( __FILE__ ) . 'adminpages/a-asso.php'; } I …
I'm relatively new to WordPress and, I am creating this plugin, where I need a submenu page. I have successfully created the main page and have added CSS to it without any problems. However, I came to need a submenu page recently. I used add_submenu_page to create that page, and it worked just fine. As far as I know, I can add as much content to that page as I want, and it won't be a problem, too. The trouble …
I'm testing WordPress 5.3 (5.3-RC4-46673) with my theme. I have WP_DEBUG enabled. I notice the following error in the dashboard now: Notice: add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be an integer representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.) in /app/wp-includes/functions.php on line 4903 There's a related ticket for this error here: Trac Ticket #48249 Troubleshooting The theme I'm using is a child theme. Disabled …
I have created a custom menu page using add_menu_page() function. Everything in that page appears as it should in the screen. What I am trying to achieve is adding another submenu under the under the page i previously created(i want it to appear just like when you click on the settings menu in wordpress dashboard). I am pasting a code snippet below: //creating the menu item for the plugin function qpv_custom_menu_link() { add_menu_page( 'Quick Product View Options', 'Quick Product View', …