Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

how would one go about redirect certain pages if the user viewing them is logged into the WordPress CMS? For example, we have 2 registration pages that when logged in should direct to some other page / category archive.


share|improve this question

1 Answer 1

up vote 1 down vote accepted

$location = The absolute URI to which the user will be redirected. No default. $status = The status code to use. For example, 301, 302, etc. The default is 302. You can use template tags for the $location parameter, for example:

<?php // redirect to the home page
wp_redirect(home_url()); exit; ?>

<?php wp_redirect('', 301); exit; ?>

If user is logged in

<?php if (is_user_logged_in() ) {
wp_redirect ( home_url("/pagename") );
share|improve this answer

Your Answer


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