Non-Standard Admin URL Hiding Network Admin Menu
-
Hey everyone,
This is quite the edge case for certain, but using the latest WordPress (4.3) and WordFence (6.0.15) versions with multisite has produced a strange bug for me. For quite awhile, the WordFence menu has been missing from my Network Admin dashboard.It turns out I’ve found the culprit.
We’ve been using a hook that changes the admin URL from /wp-admin/* to /admin/*. The code for the hook can be found in this Gist for anyone interested. It turns out that WordFence actually runs a regex check on the URL when we’re using a multisite installation, and it causes my non-standard dashboard URL to fail, and thus the WordFence menu to be hidden.
The code in question is located in /lib/wfUtils.php on lines 446-450:
public static function isAdminPageMU(){ if(preg_match('/^[\/a-zA-Z0-9\-\_\s\+\~\!\^\.]*\/wp-admin\/network\//', $_SERVER['REQUEST_URI'])){ return true; } return false; }
It seems to me that simply changing the regex check to the built in is_network_admin() function should fix this issue. The function is documented here in the WordPress Codex.
Updating the function to the following fixes the issue for me, and seems to be a better solution than re-defining a function built into WordPress:
public static function isAdminPageMU(){ return is_network_admin(); }
- The topic ‘Non-Standard Admin URL Hiding Network Admin Menu’ is closed to new replies.