geoip_detect_menu spawns notices in PHP
-
At line 24 of
admin-ui.phpthere is arequire_oncestatement which doesn’t make sense and causes my dev box to crash.By the time the
admin_menuaction is called, via theadd_actionat line 28,admin.phphas long since loaded…in fact, in the call trace, is the very first thing done. So there is nothing gained by trying to include it here.If you have reasons to need to load it that I cannot see (calling this function from outside of admin, somehow?), you should at least surround the
require_oncewith a conditional to see ifadmin.phpis already loaded:if ( ! defined( 'WP_ADMIN' ) ) { require_once ABSPATH . '/wp-admin/admin.php'; }(I believe by using
require_oncein a function, you’re short-circuiting the check to see if the file is, in fact, loaded, as PHP always tries to include files when the request is located inside a function. I think that’s what’s happening, anyway.)I see the notices when visiting any admin page access via the left admin menu which is not a standard WordPress admin page.
The topic ‘geoip_detect_menu spawns notices in PHP’ is closed to new replies.