I'm asking this question because I am coding a Wordpress plugin, and I want to be able to detect when WP-Admin is using options-general.php. Currently, I'm just checking the URL directly to see if it ends with options-general.php, but if Wordpress allows installations to change the filenames of this file, then my plugin may not work on certain installations.

  • Can you provide some context as to why you need to do this? What problem does it solve?
    – Tom J Nowell
    Nov 30, 2017 at 12:50

1 Answer 1


No, you can't, though I would rely on the Screen object, not the URL


  • The function doesn't exist in options-general.php though. Do I have to call it through the 'current_screen' hook?
    – John Doe
    Nov 30, 2017 at 5:09
  • It does, but it's possible to run your code before those files are loaded if you use the wrong hooks, see the usage restrictions in the docs
    – Tom J Nowell
    Nov 30, 2017 at 12:50
  • I looked into it and realised that I need to put my hook after admin_init, which is pretty low on the action hierarchy. Since I'm making a URL to receive AJAX requests on WP-Admin, I figure I'd just check $_SERVER['REQUEST_URI'] directly.
    – John Doe
    Nov 30, 2017 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.