This is my first post under “Today I Learned” category, where I will post tips and code snippets about solutions to some problems I found while working on my projects.
Right now I am creating a custom WordPress plugin to interact with Campaign Monitor API. In the wordpress admin panel you have a Custom Post Type called “Email Campaigns”, and that’s where we want our plugin to add a submenu.
To get the right menu item to add the submenu, you need to check the URL that it takes you. For example, by clicking on the “Email Campaigns” button, it loads the page: http://www.domain.com/wp-admin/edit.php?post_type=email-campaign. So the item that we will use will be ‘edit.php?post_type=email-campaign‘.
The function below adds the submenu to that Custom Post Type:
And this is the result: