Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12073 closed enhancement (invalid)

Query Variables for Plugin Menu Pages

Reported by: jfarthing84 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9.1
Component: Administration Keywords:
Focuses: Cc:


I would like to be able to pass query variables through the admin menu functions. For instance, I have multiple "entities" that can all be managed from the same form. However, there is no way to specify "entity=type" in the query for the menu page. So, I have to create a separate PHP file for each "entity", that in turn includes the "edit-entity.php" file along with a variable specifying which "entity" type it is. This would be easily achieved with a query value of the "entity" type. The new WordPress taxonomy system works this way. Let's support it for plugins too.

Change History (4)

#1 @jfarthing84
8 years ago

  • Cc jfarthing84@… removed

#2 @jfarthing84
8 years ago

  • Cc jeff@… added

#3 @jfarthing84
8 years ago

  • Keywords dev-feedback removed
  • Resolution set to invalid
  • Status changed from new to closed

It seems a found a way around this. Specify the file with a query variable but still use a function to include the file you wished to query. For example, instead of using the following (which doesn't work) to try and load a file:

add_submenu_page($parent, 'Title', 'Title', 'manage_options', 'my-plugin/my-page.php?key=value');

Use this and it works:

add_submenu_page($parent, 'Title', 'Title', 'manage_options', 'my-plugin/my-page.php?key=value', 'load_my_page');

function load_my_page() {

include WP_PLUGIN_DIR . '/my-plugin/my-page.php';


#4 @nacin
8 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.