WordPress.org

Make WordPress Core

Opened 23 months ago

#46082 new enhancement

Why returning $menu_array[x] instead of $title

Reported by: subrataemfluence Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: dev-feedback
Focuses: Cc:

Description

File: wp-admin/includes/plugin.php
Function: get_admin_page_title()

In lines 1613, 1616, 1637, 1645 and 1660 the following pattern of assignments and return the value are used:

$title = $menu_array[x];
return $menu_array[x];

where $tile is global.

What is the difference between the following returning patterns

$title = $menu_array[x];
return $menu_array[x];

AND

$title = $menu_array[x];
return $title;

Since we are already updating the the global variable $title with that of $menu_array[x], why can't we just return $title instead of $menu_array[x]? For every single request global $title will receive a new value.

In line 1620 the return pattern is usual:

$title = $menu_array[0];
return $title;

Change History (0)

Note: See TracTickets for help on using tickets.