I am creating my first plugin and have a single function that controls the output. This function has different output based on whether or not it is being viewed from within the WordPress admin vs. the frontend. Is there any way to easily test whether or not my function is being triggered from within admin vs the frontend?
I've tried conditionally checking the query string against the name of my plugin "page" name but it seems to fail on some servers/installs.
Thanks
How to check whether a user is administrator or not. To check if the currently logged in user is an administrator, use the current_user_can function. To check if a user is an administrator, you can specify the capability as an argument of current_user_can function (e.g. manage_options).
On your browser's address bar, search for your domain name with /wp-admin or /wp-login. php at the end, e.g., example.com/wp-admin or example.com/wp-login.php. Type in your WordPress Username or Email Address and Password.
By default WordPress creates an administrator user account named admin. Using the default Admin WordPress Account, hackers can easily launch a brute force attack against it.
Duh, this was too obvious. For some reason I was thinking this had to do with an admin user. if(is_admin()) { ...output my admin stuff....}
http://codex.wordpress.org/Function_Reference/is_admin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With