[wp-trac] [WordPress Trac] #61141: Request new function add_sites_page(...)
WordPress Trac
noreply at wordpress.org
Fri May 3 11:43:59 UTC 2024
#61141: Request new function add_sites_page(...)
---------------------------------------+-----------------------------
Reporter: ignatiusjeroe | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: minor | Keywords:
Focuses: administration, multisite |
---------------------------------------+-----------------------------
On a multisite in the Network Admin area there is a new top menu called
'Sites'. It would be beneficial to have a function that adds submenu items
to it. All other Admin top menu's have one except for this page. A couple
of examples:
{{{
add_dashboard_page()
}}}
and
{{{
add_users_page()
}}}
.
If coded the function( see below). The only thing left to alter by your
team is the code comments. The function should be placed somewhere in wp-
admin/includes/plugin.php. Below is the function code:
{{{#!php
<?php
/**
* Adds a submenu page to the Multisite Sites main menu.
*
* This function takes a capability which will be used to determine
whether
* or not a page is included in the menu.
*
* The function which is hooked in to handle the output of the page must
check
* that the user has the required capability as well.
*
* @since 6.5.x
*
* @param string $page_title The text to be displayed in the title tags
of the page when the menu is selected.
* @param string $menu_title The text to be used for the menu.
* @param string $capability The capability required for this menu to be
displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by
(should be unique for this menu).
* @param callable $callback Optional. The function to be called to
output the content for this page.
* @param int $position Optional. The position in the menu order
this item should appear.
* @return string|false The resulting page's hook_suffix, or false if the
user does not have the capability required.
*/
function add_sites_page( $page_title, $menu_title, $capability,
$menu_slug, $callback = '', $position = null ) {
return add_submenu_page( 'sites.php', $page_title, $menu_title,
$capability, $menu_slug, $callback, $position );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61141>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list