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 can't get wp_redirect working correctly? I thought I'd figured this out (see wp_redirect not working when going to www version of site) but apparently not; no idea what changed between last week when it was working and now. I tried simplifying the function down but using the following I get an infinite-redirect error:

add_action ('after_setup_theme','mkm_restrict_access',10);
function mkm_restrict_access() {
    if (!is_user_logged_in() && !is_page('splashpage') && !is_page('login')) {

I've tried using wp_footer and almost everything up the chain in terms of calling the function but nothing seems to help. I am running Theme My Login and User Domain Whitelist, if that matters. I tried disabling them but it didn't help.

I suspect I'm doing something REALLY STUPID. :( Thanks for your help!

share|improve this question
up vote 1 down vote accepted

none of those conditionals will work at after_theme_setup. Look at the Action Reference page in Codex for the order actions are executed in a request. Try hooking template_redirect instead.

share|improve this answer

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.