Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../clone/wp-admin/includes
File: plugin.php
}
[1500] Fix | Delete
[1501] Fix | Delete
$new_sub_menu = array( $menu_title, $capability, $menu_slug, $page_title );
[1502] Fix | Delete
[1503] Fix | Delete
if ( null !== $position && ! is_numeric( $position ) ) {
[1504] Fix | Delete
_doing_it_wrong(
[1505] Fix | Delete
__FUNCTION__,
[1506] Fix | Delete
sprintf(
[1507] Fix | Delete
/* translators: %s: add_submenu_page() */
[1508] Fix | Delete
__( 'The seventh parameter passed to %s should be numeric representing menu position.' ),
[1509] Fix | Delete
'<code>add_submenu_page()</code>'
[1510] Fix | Delete
),
[1511] Fix | Delete
'5.3.0'
[1512] Fix | Delete
);
[1513] Fix | Delete
$position = null;
[1514] Fix | Delete
}
[1515] Fix | Delete
[1516] Fix | Delete
if (
[1517] Fix | Delete
null === $position ||
[1518] Fix | Delete
( ! isset( $submenu[ $parent_slug ] ) || $position >= count( $submenu[ $parent_slug ] ) )
[1519] Fix | Delete
) {
[1520] Fix | Delete
$submenu[ $parent_slug ][] = $new_sub_menu;
[1521] Fix | Delete
} else {
[1522] Fix | Delete
// Test for a negative position.
[1523] Fix | Delete
$position = max( $position, 0 );
[1524] Fix | Delete
if ( 0 === $position ) {
[1525] Fix | Delete
// For negative or `0` positions, prepend the submenu.
[1526] Fix | Delete
array_unshift( $submenu[ $parent_slug ], $new_sub_menu );
[1527] Fix | Delete
} else {
[1528] Fix | Delete
$position = absint( $position );
[1529] Fix | Delete
// Grab all of the items before the insertion point.
[1530] Fix | Delete
$before_items = array_slice( $submenu[ $parent_slug ], 0, $position, true );
[1531] Fix | Delete
// Grab all of the items after the insertion point.
[1532] Fix | Delete
$after_items = array_slice( $submenu[ $parent_slug ], $position, null, true );
[1533] Fix | Delete
// Add the new item.
[1534] Fix | Delete
$before_items[] = $new_sub_menu;
[1535] Fix | Delete
// Merge the items.
[1536] Fix | Delete
$submenu[ $parent_slug ] = array_merge( $before_items, $after_items );
[1537] Fix | Delete
}
[1538] Fix | Delete
}
[1539] Fix | Delete
[1540] Fix | Delete
// Sort the parent array.
[1541] Fix | Delete
ksort( $submenu[ $parent_slug ] );
[1542] Fix | Delete
[1543] Fix | Delete
$hookname = get_plugin_page_hookname( $menu_slug, $parent_slug );
[1544] Fix | Delete
if ( ! empty( $callback ) && ! empty( $hookname ) ) {
[1545] Fix | Delete
add_action( $hookname, $callback );
[1546] Fix | Delete
}
[1547] Fix | Delete
[1548] Fix | Delete
$_registered_pages[ $hookname ] = true;
[1549] Fix | Delete
[1550] Fix | Delete
/*
[1551] Fix | Delete
* Backward-compatibility for plugins using add_management_page().
[1552] Fix | Delete
* See wp-admin/admin.php for redirect from edit.php to tools.php.
[1553] Fix | Delete
*/
[1554] Fix | Delete
if ( 'tools.php' === $parent_slug ) {
[1555] Fix | Delete
$_registered_pages[ get_plugin_page_hookname( $menu_slug, 'edit.php' ) ] = true;
[1556] Fix | Delete
}
[1557] Fix | Delete
[1558] Fix | Delete
// No parent as top level.
[1559] Fix | Delete
$_parent_pages[ $menu_slug ] = $parent_slug;
[1560] Fix | Delete
[1561] Fix | Delete
return $hookname;
[1562] Fix | Delete
}
[1563] Fix | Delete
[1564] Fix | Delete
/**
[1565] Fix | Delete
* Adds a submenu page to the Tools main menu.
[1566] Fix | Delete
*
[1567] Fix | Delete
* This function takes a capability which will be used to determine whether
[1568] Fix | Delete
* or not a page is included in the menu.
[1569] Fix | Delete
*
[1570] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1571] Fix | Delete
* that the user has the required capability as well.
[1572] Fix | Delete
*
[1573] Fix | Delete
* @since 1.5.0
[1574] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1575] Fix | Delete
*
[1576] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1577] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1578] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1579] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1580] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1581] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1582] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1583] Fix | Delete
*/
[1584] Fix | Delete
function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1585] Fix | Delete
return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1586] Fix | Delete
}
[1587] Fix | Delete
[1588] Fix | Delete
/**
[1589] Fix | Delete
* Adds a submenu page to the Settings main menu.
[1590] Fix | Delete
*
[1591] Fix | Delete
* This function takes a capability which will be used to determine whether
[1592] Fix | Delete
* or not a page is included in the menu.
[1593] Fix | Delete
*
[1594] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1595] Fix | Delete
* that the user has the required capability as well.
[1596] Fix | Delete
*
[1597] Fix | Delete
* @since 1.5.0
[1598] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1599] Fix | Delete
*
[1600] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1601] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1602] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1603] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1604] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1605] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1606] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1607] Fix | Delete
*/
[1608] Fix | Delete
function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1609] Fix | Delete
return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1610] Fix | Delete
}
[1611] Fix | Delete
[1612] Fix | Delete
/**
[1613] Fix | Delete
* Adds a submenu page to the Appearance main menu.
[1614] Fix | Delete
*
[1615] Fix | Delete
* This function takes a capability which will be used to determine whether
[1616] Fix | Delete
* or not a page is included in the menu.
[1617] Fix | Delete
*
[1618] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1619] Fix | Delete
* that the user has the required capability as well.
[1620] Fix | Delete
*
[1621] Fix | Delete
* @since 2.0.0
[1622] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1623] Fix | Delete
*
[1624] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1625] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1626] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1627] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1628] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1629] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1630] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1631] Fix | Delete
*/
[1632] Fix | Delete
function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1633] Fix | Delete
return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1634] Fix | Delete
}
[1635] Fix | Delete
[1636] Fix | Delete
/**
[1637] Fix | Delete
* Adds a submenu page to the Plugins main menu.
[1638] Fix | Delete
*
[1639] Fix | Delete
* This function takes a capability which will be used to determine whether
[1640] Fix | Delete
* or not a page is included in the menu.
[1641] Fix | Delete
*
[1642] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1643] Fix | Delete
* that the user has the required capability as well.
[1644] Fix | Delete
*
[1645] Fix | Delete
* @since 3.0.0
[1646] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1647] Fix | Delete
*
[1648] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1649] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1650] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1651] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1652] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1653] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1654] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1655] Fix | Delete
*/
[1656] Fix | Delete
function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1657] Fix | Delete
return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1658] Fix | Delete
}
[1659] Fix | Delete
[1660] Fix | Delete
/**
[1661] Fix | Delete
* Adds a submenu page to the Users/Profile main menu.
[1662] Fix | Delete
*
[1663] Fix | Delete
* This function takes a capability which will be used to determine whether
[1664] Fix | Delete
* or not a page is included in the menu.
[1665] Fix | Delete
*
[1666] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1667] Fix | Delete
* that the user has the required capability as well.
[1668] Fix | Delete
*
[1669] Fix | Delete
* @since 2.1.3
[1670] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1671] Fix | Delete
*
[1672] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1673] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1674] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1675] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1676] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1677] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1678] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1679] Fix | Delete
*/
[1680] Fix | Delete
function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1681] Fix | Delete
if ( current_user_can( 'edit_users' ) ) {
[1682] Fix | Delete
$parent = 'users.php';
[1683] Fix | Delete
} else {
[1684] Fix | Delete
$parent = 'profile.php';
[1685] Fix | Delete
}
[1686] Fix | Delete
return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1687] Fix | Delete
}
[1688] Fix | Delete
[1689] Fix | Delete
/**
[1690] Fix | Delete
* Adds a submenu page to the Dashboard main menu.
[1691] Fix | Delete
*
[1692] Fix | Delete
* This function takes a capability which will be used to determine whether
[1693] Fix | Delete
* or not a page is included in the menu.
[1694] Fix | Delete
*
[1695] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1696] Fix | Delete
* that the user has the required capability as well.
[1697] Fix | Delete
*
[1698] Fix | Delete
* @since 2.7.0
[1699] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1700] Fix | Delete
*
[1701] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1702] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1703] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1704] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1705] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1706] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1707] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1708] Fix | Delete
*/
[1709] Fix | Delete
function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1710] Fix | Delete
return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1711] Fix | Delete
}
[1712] Fix | Delete
[1713] Fix | Delete
/**
[1714] Fix | Delete
* Adds a submenu page to the Posts main menu.
[1715] Fix | Delete
*
[1716] Fix | Delete
* This function takes a capability which will be used to determine whether
[1717] Fix | Delete
* or not a page is included in the menu.
[1718] Fix | Delete
*
[1719] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1720] Fix | Delete
* that the user has the required capability as well.
[1721] Fix | Delete
*
[1722] Fix | Delete
* @since 2.7.0
[1723] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1724] Fix | Delete
*
[1725] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1726] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1727] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1728] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1729] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1730] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1731] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1732] Fix | Delete
*/
[1733] Fix | Delete
function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1734] Fix | Delete
return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1735] Fix | Delete
}
[1736] Fix | Delete
[1737] Fix | Delete
/**
[1738] Fix | Delete
* Adds a submenu page to the Media main menu.
[1739] Fix | Delete
*
[1740] Fix | Delete
* This function takes a capability which will be used to determine whether
[1741] Fix | Delete
* or not a page is included in the menu.
[1742] Fix | Delete
*
[1743] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1744] Fix | Delete
* that the user has the required capability as well.
[1745] Fix | Delete
*
[1746] Fix | Delete
* @since 2.7.0
[1747] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1748] Fix | Delete
*
[1749] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1750] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1751] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1752] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1753] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1754] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1755] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1756] Fix | Delete
*/
[1757] Fix | Delete
function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1758] Fix | Delete
return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1759] Fix | Delete
}
[1760] Fix | Delete
[1761] Fix | Delete
/**
[1762] Fix | Delete
* Adds a submenu page to the Links main menu.
[1763] Fix | Delete
*
[1764] Fix | Delete
* This function takes a capability which will be used to determine whether
[1765] Fix | Delete
* or not a page is included in the menu.
[1766] Fix | Delete
*
[1767] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1768] Fix | Delete
* that the user has the required capability as well.
[1769] Fix | Delete
*
[1770] Fix | Delete
* @since 2.7.0
[1771] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1772] Fix | Delete
*
[1773] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1774] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1775] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1776] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1777] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1778] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1779] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1780] Fix | Delete
*/
[1781] Fix | Delete
function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1782] Fix | Delete
return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1783] Fix | Delete
}
[1784] Fix | Delete
[1785] Fix | Delete
/**
[1786] Fix | Delete
* Adds a submenu page to the Pages main menu.
[1787] Fix | Delete
*
[1788] Fix | Delete
* This function takes a capability which will be used to determine whether
[1789] Fix | Delete
* or not a page is included in the menu.
[1790] Fix | Delete
*
[1791] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1792] Fix | Delete
* that the user has the required capability as well.
[1793] Fix | Delete
*
[1794] Fix | Delete
* @since 2.7.0
[1795] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1796] Fix | Delete
*
[1797] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1798] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1799] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1800] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1801] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1802] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1803] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1804] Fix | Delete
*/
[1805] Fix | Delete
function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1806] Fix | Delete
return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1807] Fix | Delete
}
[1808] Fix | Delete
[1809] Fix | Delete
/**
[1810] Fix | Delete
* Adds a submenu page to the Comments main menu.
[1811] Fix | Delete
*
[1812] Fix | Delete
* This function takes a capability which will be used to determine whether
[1813] Fix | Delete
* or not a page is included in the menu.
[1814] Fix | Delete
*
[1815] Fix | Delete
* The function which is hooked in to handle the output of the page must check
[1816] Fix | Delete
* that the user has the required capability as well.
[1817] Fix | Delete
*
[1818] Fix | Delete
* @since 2.7.0
[1819] Fix | Delete
* @since 5.3.0 Added the `$position` parameter.
[1820] Fix | Delete
*
[1821] Fix | Delete
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
[1822] Fix | Delete
* @param string $menu_title The text to be used for the menu.
[1823] Fix | Delete
* @param string $capability The capability required for this menu to be displayed to the user.
[1824] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1825] Fix | Delete
* @param callable $callback Optional. The function to be called to output the content for this page.
[1826] Fix | Delete
* @param int $position Optional. The position in the menu order this item should appear.
[1827] Fix | Delete
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
[1828] Fix | Delete
*/
[1829] Fix | Delete
function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
[1830] Fix | Delete
return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
[1831] Fix | Delete
}
[1832] Fix | Delete
[1833] Fix | Delete
/**
[1834] Fix | Delete
* Removes a top-level admin menu.
[1835] Fix | Delete
*
[1836] Fix | Delete
* Example usage:
[1837] Fix | Delete
*
[1838] Fix | Delete
* - `remove_menu_page( 'tools.php' )`
[1839] Fix | Delete
* - `remove_menu_page( 'plugin_menu_slug' )`
[1840] Fix | Delete
*
[1841] Fix | Delete
* @since 3.1.0
[1842] Fix | Delete
*
[1843] Fix | Delete
* @global array $menu
[1844] Fix | Delete
*
[1845] Fix | Delete
* @param string $menu_slug The slug of the menu.
[1846] Fix | Delete
* @return array|false The removed menu on success, false if not found.
[1847] Fix | Delete
*/
[1848] Fix | Delete
function remove_menu_page( $menu_slug ) {
[1849] Fix | Delete
global $menu;
[1850] Fix | Delete
[1851] Fix | Delete
foreach ( $menu as $i => $item ) {
[1852] Fix | Delete
if ( $menu_slug === $item[2] ) {
[1853] Fix | Delete
unset( $menu[ $i ] );
[1854] Fix | Delete
return $item;
[1855] Fix | Delete
}
[1856] Fix | Delete
}
[1857] Fix | Delete
[1858] Fix | Delete
return false;
[1859] Fix | Delete
}
[1860] Fix | Delete
[1861] Fix | Delete
/**
[1862] Fix | Delete
* Removes an admin submenu.
[1863] Fix | Delete
*
[1864] Fix | Delete
* Example usage:
[1865] Fix | Delete
*
[1866] Fix | Delete
* - `remove_submenu_page( 'themes.php', 'nav-menus.php' )`
[1867] Fix | Delete
* - `remove_submenu_page( 'tools.php', 'plugin_submenu_slug' )`
[1868] Fix | Delete
* - `remove_submenu_page( 'plugin_menu_slug', 'plugin_submenu_slug' )`
[1869] Fix | Delete
*
[1870] Fix | Delete
* @since 3.1.0
[1871] Fix | Delete
*
[1872] Fix | Delete
* @global array $submenu
[1873] Fix | Delete
*
[1874] Fix | Delete
* @param string $menu_slug The slug for the parent menu.
[1875] Fix | Delete
* @param string $submenu_slug The slug of the submenu.
[1876] Fix | Delete
* @return array|false The removed submenu on success, false if not found.
[1877] Fix | Delete
*/
[1878] Fix | Delete
function remove_submenu_page( $menu_slug, $submenu_slug ) {
[1879] Fix | Delete
global $submenu;
[1880] Fix | Delete
[1881] Fix | Delete
if ( ! isset( $submenu[ $menu_slug ] ) ) {
[1882] Fix | Delete
return false;
[1883] Fix | Delete
}
[1884] Fix | Delete
[1885] Fix | Delete
foreach ( $submenu[ $menu_slug ] as $i => $item ) {
[1886] Fix | Delete
if ( $submenu_slug === $item[2] ) {
[1887] Fix | Delete
unset( $submenu[ $menu_slug ][ $i ] );
[1888] Fix | Delete
return $item;
[1889] Fix | Delete
}
[1890] Fix | Delete
}
[1891] Fix | Delete
[1892] Fix | Delete
return false;
[1893] Fix | Delete
}
[1894] Fix | Delete
[1895] Fix | Delete
/**
[1896] Fix | Delete
* Gets the URL to access a particular menu page based on the slug it was registered with.
[1897] Fix | Delete
*
[1898] Fix | Delete
* If the slug hasn't been registered properly, no URL will be returned.
[1899] Fix | Delete
*
[1900] Fix | Delete
* @since 3.0.0
[1901] Fix | Delete
*
[1902] Fix | Delete
* @global array $_parent_pages
[1903] Fix | Delete
*
[1904] Fix | Delete
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
[1905] Fix | Delete
* @param bool $display Optional. Whether or not to display the URL. Default true.
[1906] Fix | Delete
* @return string The menu page URL.
[1907] Fix | Delete
*/
[1908] Fix | Delete
function menu_page_url( $menu_slug, $display = true ) {
[1909] Fix | Delete
global $_parent_pages;
[1910] Fix | Delete
[1911] Fix | Delete
if ( isset( $_parent_pages[ $menu_slug ] ) ) {
[1912] Fix | Delete
$parent_slug = $_parent_pages[ $menu_slug ];
[1913] Fix | Delete
[1914] Fix | Delete
if ( $parent_slug && ! isset( $_parent_pages[ $parent_slug ] ) ) {
[1915] Fix | Delete
$url = admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) );
[1916] Fix | Delete
} else {
[1917] Fix | Delete
$url = admin_url( 'admin.php?page=' . $menu_slug );
[1918] Fix | Delete
}
[1919] Fix | Delete
} else {
[1920] Fix | Delete
$url = '';
[1921] Fix | Delete
}
[1922] Fix | Delete
[1923] Fix | Delete
$url = esc_url( $url );
[1924] Fix | Delete
[1925] Fix | Delete
if ( $display ) {
[1926] Fix | Delete
echo $url;
[1927] Fix | Delete
}
[1928] Fix | Delete
[1929] Fix | Delete
return $url;
[1930] Fix | Delete
}
[1931] Fix | Delete
[1932] Fix | Delete
//
[1933] Fix | Delete
// Pluggable Menu Support -- Private.
[1934] Fix | Delete
//
[1935] Fix | Delete
/**
[1936] Fix | Delete
* Gets the parent file of the current admin page.
[1937] Fix | Delete
*
[1938] Fix | Delete
* @since 1.5.0
[1939] Fix | Delete
*
[1940] Fix | Delete
* @global string $parent_file
[1941] Fix | Delete
* @global array $menu
[1942] Fix | Delete
* @global array $submenu
[1943] Fix | Delete
* @global string $pagenow The filename of the current screen.
[1944] Fix | Delete
* @global string $typenow The post type of the current screen.
[1945] Fix | Delete
* @global string $plugin_page
[1946] Fix | Delete
* @global array $_wp_real_parent_file
[1947] Fix | Delete
* @global array $_wp_menu_nopriv
[1948] Fix | Delete
* @global array $_wp_submenu_nopriv
[1949] Fix | Delete
*
[1950] Fix | Delete
* @param string $parent_page Optional. The slug name for the parent menu (or the file name
[1951] Fix | Delete
* of a standard WordPress admin page). Default empty string.
[1952] Fix | Delete
* @return string The parent file of the current admin page.
[1953] Fix | Delete
*/
[1954] Fix | Delete
function get_admin_page_parent( $parent_page = '' ) {
[1955] Fix | Delete
global $parent_file, $menu, $submenu, $pagenow, $typenow,
[1956] Fix | Delete
$plugin_page, $_wp_real_parent_file, $_wp_menu_nopriv, $_wp_submenu_nopriv;
[1957] Fix | Delete
[1958] Fix | Delete
if ( ! empty( $parent_page ) && 'admin.php' !== $parent_page ) {
[1959] Fix | Delete
if ( isset( $_wp_real_parent_file[ $parent_page ] ) ) {
[1960] Fix | Delete
$parent_page = $_wp_real_parent_file[ $parent_page ];
[1961] Fix | Delete
}
[1962] Fix | Delete
[1963] Fix | Delete
return $parent_page;
[1964] Fix | Delete
}
[1965] Fix | Delete
[1966] Fix | Delete
if ( 'admin.php' === $pagenow && isset( $plugin_page ) ) {
[1967] Fix | Delete
foreach ( (array) $menu as $parent_menu ) {
[1968] Fix | Delete
if ( $parent_menu[2] === $plugin_page ) {
[1969] Fix | Delete
$parent_file = $plugin_page;
[1970] Fix | Delete
[1971] Fix | Delete
if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) {
[1972] Fix | Delete
$parent_file = $_wp_real_parent_file[ $parent_file ];
[1973] Fix | Delete
}
[1974] Fix | Delete
[1975] Fix | Delete
return $parent_file;
[1976] Fix | Delete
}
[1977] Fix | Delete
}
[1978] Fix | Delete
if ( isset( $_wp_menu_nopriv[ $plugin_page ] ) ) {
[1979] Fix | Delete
$parent_file = $plugin_page;
[1980] Fix | Delete
[1981] Fix | Delete
if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) {
[1982] Fix | Delete
$parent_file = $_wp_real_parent_file[ $parent_file ];
[1983] Fix | Delete
}
[1984] Fix | Delete
[1985] Fix | Delete
return $parent_file;
[1986] Fix | Delete
}
[1987] Fix | Delete
}
[1988] Fix | Delete
[1989] Fix | Delete
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $pagenow ][ $plugin_page ] ) ) {
[1990] Fix | Delete
$parent_file = $pagenow;
[1991] Fix | Delete
[1992] Fix | Delete
if ( isset( $_wp_real_parent_file[ $parent_file ] ) ) {
[1993] Fix | Delete
$parent_file = $_wp_real_parent_file[ $parent_file ];
[1994] Fix | Delete
}
[1995] Fix | Delete
[1996] Fix | Delete
return $parent_file;
[1997] Fix | Delete
}
[1998] Fix | Delete
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function