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!


1 Answer 1


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.

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.