WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 5 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:

Description

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)

comment:1 @jfarthing845 years ago

  • Cc jfarthing84@… removed

comment:2 @jfarthing845 years ago

  • Cc jeff@… added

comment:3 @jfarthing845 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';

}

comment:4 @nacin5 years ago

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