Skip to content

Commit 2e4be8b

Browse files
Coding Standards: Explicitly return null in wp_get_nav_menu_to_edit().
This commit updates the function to explicitly return `null` if a valid `$menu_id` is not passed or the term does not exist. Previously, the function could return `void`, but was typed as only returning a string or a `WP_Error` object. Follow-up to [14248]. Props justlevine. See #63268. git-svn-id: https://develop.svn.wordpress.org/trunk@60180 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d9534e1 commit 2e4be8b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/wp-admin/includes/nav-menu.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,8 @@ function _wp_nav_menu_meta_box_object( $data_object = null ) {
12391239
* @since 3.0.0
12401240
*
12411241
* @param int $menu_id Optional. The ID of the menu to format. Default 0.
1242-
* @return string|WP_Error The menu formatted to edit or error object on failure.
1242+
* @return string|WP_Error|null The menu formatted to edit or error object on failure.
1243+
* Null if the `$menu_id` parameter is not supplied or the term does not exist.
12431244
*/
12441245
function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
12451246
$menu = wp_get_nav_menu_object( $menu_id );
@@ -1321,6 +1322,8 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
13211322
} elseif ( is_wp_error( $menu ) ) {
13221323
return $menu;
13231324
}
1325+
1326+
return null;
13241327
}
13251328

13261329
/**

0 commit comments

Comments
 (0)