0
votes

I am developing a plugin which is called WP My Plugin (renamed) and its added under WordPress admin settings menu.

Now, this plugin URL is look like this:

enter image description here

http://localhost/xxx/wp-admin/options-general.php?page=wp-my-plugin

Now, I want to add query string to end of that URL. So final URL will be:

http://localhost/xxx/wp-admin/options-general.php?page=wp-my-plugin&tab=general

Can you tell me how can I do this?

1

1 Answers

0
votes

Hello you can add query string by using action.

Add the below code in your current active theme functions.php file.

Before add the code make sure you have write the correct $submenu['options-general.php'][47][2] index. To check this please print_r($submenu); and replace with your key.

add_action( 'admin_menu','add_custom_query_string');
function add_custom_query_string()
{
    global $submenu; 
    //print_r($submenu);die;
    $submenu['options-general.php'][47][2] = 'options-general.php?page=wp-my-plugin&tab=general';
}

Thanks