check for the current screen
Those variables and functions only exist in the admin area, and aren’t for frontend use. You will need to use a different mechanism for the frontend. Additionally: the docs say that you have to call this after the admin_init hook, calling on that hook will always return null the function is not loaded on all … Read more