Skip to content

"Aliases" tab missing in network site settings #126

Description

@villeveikkoilen

Problem

One day I noticed that the Aliases settings tab was missing in network site settings. I traced the problem to The Events Calendar PRO plugin. When that plugin was activated, the tab disappeared, and when I deactivated it, the tab re-appeared.

In my understanding, the problem is in the following lines of code:

Mercator/admin.php

Lines 64 to 66 in 9240e7c

if ( $GLOBALS['parent_file'] !== 'sites.php' || $GLOBALS['submenu_file'] !== 'sites.php' ) {
return;
}

For some reason, I don't know why, when TEC plugin is activated, $GLOBALS['submenu_file'] value is NULL, when it should be sites.php.

Versions

  • WordPress: 5.9.3
  • The Events Calendar PRO: 5.14.0.1
  • Mercator: 1.0.3

Possible fix (POC)

There's a proper way of getting current admin screen instead of reading globals. My suggestion would be to replace these lines:

Mercator/admin.php

Lines 64 to 66 in 9240e7c

if ( $GLOBALS['parent_file'] !== 'sites.php' || $GLOBALS['submenu_file'] !== 'sites.php' ) {
return;
}

with:

$current_screen = get_current_screen();

if ( empty($current_screen->id) || ($current_screen->id !== 'site-info-network' && $current_screen->id !== 'admin-network' ) ) {
	return;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions