I use this after I checked if the user is admin
if ( isset($_GET['action']) && $_GET['action'] === 'edit' )
is there better way?
I use this after I checked if the user is admin
if ( isset($_GET['action']) && $_GET['action'] === 'edit' )
is there better way?
Comments are closed.
You can use
get_current_screen
to determine this.I don’t know if I exactly would say this is always better, it depends on what’s needed, but it’s probably the way I’d do it. The big benefit with this method is that you get access to more information and ergo can do more and different distinctions. Just take a look at the documentation to understand what I mean.
It should be used in later hooks, Codex says:
Better way:
global variable $pagenow
source: https://wordpress.stackexchange.com/a/7281/33667
sentence, with emphasis on admin pages).
quite likely the next thing you want to figure out is, if you are actually on a page or post…