humanmade / humanmade/Mercator
"Aliases" tab missing in network site settings
- Dominant language
- PHP
- Stars
- 527
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
## 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:
https://github.com/humanmade/Mercator/blob/9240e7cce9882a9fe452ced8a5cf7845d60c5a2e/admin.php#L64-L66
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:
https://github.com/humanmade/Mercator/blob/9240e7cce9882a9fe452ced8a5cf7845d60c5a2e/admin.php#L64-L66
with:
```php
$current_screen = get_current_screen();
if ( empty($current_screen->id) || ($current_screen->id !== 'site-info-network' && $current_screen->id !== 'admin-network' ) ) {
return;
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.