mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Administration: Trigger a notice for incorrect add_menu_page()
parameter.
Trigger a notice (via `_doing_it_wrong()`) for developers incorrectly setting the position when calling `add_menu_page()`. Modify a similar message in `add_submenu_page()` to combine near identical strings and match the error description to the conditions in which it is called. Follow up to [52569], [53104]. Fixes #40927. Built from https://develop.svn.wordpress.org/trunk@53264 git-svn-id: http://core.svn.wordpress.org/trunk@52853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
df148d90fc
commit
e9610a5d20
@ -1325,6 +1325,19 @@ function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $call
|
||||
|
||||
$new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url );
|
||||
|
||||
if ( null !== $position && ! is_numeric( $position ) ) {
|
||||
_doing_it_wrong(
|
||||
__FUNCTION__,
|
||||
sprintf(
|
||||
/* translators: %s: add_menu_page() */
|
||||
__( 'The seventh parameter passed to %s should be numeric representing menu position.' ),
|
||||
'<code>add_menu_page()</code>'
|
||||
),
|
||||
'6.0.0'
|
||||
);
|
||||
$position = null;
|
||||
}
|
||||
|
||||
if ( null === $position || ! is_numeric( $position ) ) {
|
||||
$menu[] = $new_menu;
|
||||
} elseif ( isset( $menu[ (string) $position ] ) ) {
|
||||
@ -1421,7 +1434,7 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
|
||||
__FUNCTION__,
|
||||
sprintf(
|
||||
/* translators: %s: add_submenu_page() */
|
||||
__( 'The seventh parameter passed to %s should be an integer representing menu position.' ),
|
||||
__( 'The seventh parameter passed to %s should be numeric representing menu position.' ),
|
||||
'<code>add_submenu_page()</code>'
|
||||
),
|
||||
'5.3.0'
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-beta2-53263';
|
||||
$wp_version = '6.0-beta2-53264';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user