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.

I don't need my plugin running through wp-admin, including wp-login. How could I prevent it? is_admin works fine but i don't know how to ignore everything related to wp-admin (like wp-login.php). Thanks.

share|improve this question
5  
What is your Plugin doing, and what hooks are you using to hook your Plugin into WordPress? –  Chip Bennett Sep 26 '11 at 13:34
add comment

1 Answer 1

Check the requested URI:

if(!is_admin()
 && strpos($_SERVER['REQUEST_URI'], 'wp-login.php') === false 
 && strpos($_SERVER['REQUEST_URI'], 'wp-signup.php') === false) { ... }

But it's probably better to use a white-list style:

if(is_front_page() || is_singular() || is_archive()) { ... }

These 3 tags should cover pretty much all of the front-end...

share|improve this answer
1  
FYI: You can check $pagenow to find out the page, it'll look a little nicer than the $_SERVER checks.. –  t31os Jul 26 '11 at 11:24
1  
It totally depends on what the Plugin is actually doing. The query conditionals may or may not be available at the execution point at which the Plugin operates. –  Chip Bennett Sep 26 '11 at 13:36
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.