Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
    
will it work for other user like subscriber ? –  Ajay Patel Mar 13 '12 at 5:42
    
Yep. It works for all roles. –  Rutwick Gangurde Mar 13 '12 at 5:42
    
How about loading a script on a specific admin page? –  AlxVallejo Dec 27 '12 at 1:01
    
The action hook admin_print_scripts is meant to do that. –  Rutwick Gangurde Dec 27 '12 at 5:09
add comment

Use is_admin() to check if the the current page is an administration page. Despite its name this is not a user role check.

share|improve this answer
    
will it work for other user like subscriber ? –  Ajay Patel Mar 13 '12 at 5:42
1  
Read the Codex page: is_admin() returns always FALSE on front end. No matter which role the user has. –  toscho Mar 13 '12 at 5:43
    
Yes, it works thanks a lot –  Ajay Patel Mar 13 '12 at 5:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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