In my application, i have one form. Now if user is in front end i want to display the title but if he is in back end i do not want to display it.

I do not want to check it based on user role.


2 Answers 2


Use is_admin(). It checks if you're viewing an Admin page, means the backend.

  • will it work for other user like subscriber ?
    – Ajay Patel
    Commented Mar 13, 2012 at 5:42
  • Yep. It works for all roles. Commented Mar 13, 2012 at 5:42
  • How about loading a script on a specific admin page?
    – AlxVallejo
    Commented Dec 27, 2012 at 1:01
  • The action hook admin_print_scripts is meant to do that. Commented Dec 27, 2012 at 5:09
  • 5
    Of note, an ajax request will make this return TRUE. Also, right in the documentation it says that this is not meant to be used as a security check. Commented Dec 12, 2017 at 16:54

Use is_admin() to check if the the current page is an administration page. Despite its name this is not a user role check. It returns always FALSE on front end, no matter what role the user has.

  • False since the shitty blocks editor has been purged down the WP Community's throat: core.trac.wordpress.org/ticket/47394 Since then, you can not anymore safely define if you are moving around the admin, or the front end.
    – user75665
    Commented Mar 3, 2023 at 8:36
  • @BedaSchmid - What's the alternative to is_admin?
    – Motivated
    Commented Jun 28, 2023 at 8:08
  • @Motivated there is none. You have to do a BUNCH of checks now, such as if it is during an ajax event, if it is some specific screen, if it is a block editing thing, if the user is logged in, if the user has cap... etc. This never was any different in terms of security since is_admin does NOT check if the user is somehow admin or not, but, at least it was able to tell you generically if it was an admin area (unless during AJAX requests, which is always is_admin). The joke is, that blocks editors tell you is_admin FALSE, because it does not run "in the backend" but over REST.
    – user75665
    Commented Jun 29, 2023 at 1:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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