Articles of add submenu page

sub-page settings saving in NETWORK DASHBOARD

In single WP installations, on a plugin’s generated sub-page, you put <form action=”options.php” … does the job well. However, in Multisite Network sub-page, options.php doesnt work, nor settings.php (it redirects to that page after form submission)… I cant find out what page to use there, to send <form> values to that page which will save […]

Show category and tag link as a submenu under custom post type submenu

I have created a college management menu in admin, under that i have added some sub menus those submenus are of different post types. Those were working fine. But Category and tags are not showing as sub-sub-menu under custom post types College Management /* Main menu */ — Faculty /* Sub menu Custom post type […]

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 make the first submenu have a different name than the main menu // Details: add_submenu_page(‘Books’, ‘Books’, ‘All Books’, ‘publish_posts’, ‘books’, ‘render_books_page’); // The Add Book menu […]

Prevent Admin gui output from page added using add_submenu_page

I have created a download link for my plugin using add_submenu_page. When the link is clicked it gathers some files into a zip, then outputs the contents to the browser like so: header(‘Content-Type: application/zip’); header(‘Content-Length: ‘ . filesize($file)); header(‘Content-Disposition: attachment; filename=””‘); readfile($file); unlink($file); The issue is that wordpress by default wraps everything in it’s admin […]

Create dynamic wordrpess blank page

I’ve created a submenu in wordpress using add_submenu_page: add_submenu_page(null,’Page Title’,’Page Title’,’administrator’,’page-slug’,’page-callback’); I want to create another page like this with the condition that the page will be totally blank without creating a new file does wordpress have a function like this?I want it because I want to generate and download an xml file there and […]

How to add more than 1 user role to sub-menu pages

I create a plugin with 6 submenu pages. I need 4 of them to be accessible by administrator and a custom user role i created say ‘coach’ user. Then the 2 of them to be accessible by administrator and another custom user role ‘player’. How would i do that to add 2 user role?

How to see everything in get_option()?

In theme and plugin development I like to completely run through everything to make sure there are no issues and I’m not getting any errors. ONLY in development do I add the following in my footer.php to see what is going on: if (is_user_logged_in()) : // GET POST META // global $wp_query; $post_meta = […]

WordPress template – How to add class to li tag if submenu exist

for example i want create this menu: <div class=”menu_wrap”> <ul class=”nav sf-menu”> <li class=”sub-menu”><a href=””>Main Menu 1</a> <ul> <li><a href=””><span>-</span>Sub Menu 1</a></li> <li><a href=””><span>-</span>Sub Menu 2</a></li> </ul> </li> <li class=”sub-menu”><a href=””>Main Menu 2</a> <ul> <li><a href=””><span>-</span>Sub Menu 1</a></li> <li><a href=””><span>-</span>Sub Menu 2</a></li> </ul> </li> <li><a href=””>Main Menu 3 without sub menu</a></li> </ul> how to add […]

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 example, when you visit the sample settings page the menu created is: function wporg_options_page() { // add top level menu page […]

How to add custom submenu links in wp-admin menus?

Is it possible to add custom links as submenu on menu that already exist in wp-admin? Like for example, under appearance section like this: