When plugins grow in complexity, their configuration options often grow in numbers, giving users a high level of flexibility in choosing how the plugin behaves on their site. While it is possible to display all the plugin options on a single lengthy configuration page, creating a new top-level menu item with multiple sections can help organize parameters in logical groupings that will allow users to find what they are looking for more quickly.
This recipe shows how to create a new top-level menu item in the administration menu with an accompanying submenu item.
- Navigate to the WordPress plugin directory of your development installation.
- Create a new directory called
ch3-multi-level-menu
. - Navigate to this directory and create a new text file called
ch3-multi-level-menu.php
. - Open the new file in a code editor and add an appropriate header at the top of the plugin file, naming the plugin
Chapter 3 - Multi-level menu
. - Add the following line...