I want to set it to any parameter when creating a page with add_menu_page of WordPress
The desired URL is:
Normally it is a parameter that is page, but I want to make it search_page.

Trial code

First, when you execute add_menu_page normally,

$template ='';
$x ='mypost';
add_menu_page ($x, $x,'manage_options', $x, $template,'dashicons-search', 3);

The URL is now a parameter called page:


For referenceChange the fourth argumentSo when I specified the following,

add_menu_page ($x, $x,'manage_options', "search_page = {$x}", $template,'dashicons-search', 3);

In a URL like this, only its value changed, not the parameter.


How can I specify the desired parameters?
Or maybe WordPress doesn't have such a feature?

  • Answer # 1

    If you want to change the link of the additional menu to any URL
    Fifth argument must be null
    Is the fourth argument in that case specified from the file name?
    Enter the URL of the link destination as it is

    add_menu_page ($x, $x,'manage_options', "admin.php? search_page = {$x}", null,'dashicons-search', 3);