WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried this inside of my plugin ('init' hook) but it doesn't work:

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

How could I check it using init hook? Thanks.

share|improve this question

init is too early for conditional tags to work. It marks when core finished loading, but no environment is set up yet.

For admin area only you can hook into admin_init.

For conditionals on front end earliest hook you can reliable use is template_redirect.

share|improve this answer
Is template_redirect executed before headers are send? Thanks. – thom Jul 26 '11 at 12:16
@thom yes, there should be no output before it. – Rarst Jul 26 '11 at 13:17
Rarst, thanks so much for this. You solved my problem by giving info on the template_redirect hook. now the is_page('page name') method works perfectly! – ClockwiseQ Apr 20 '13 at 15:00

Your Answer


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.