Redirect one page to anothe When user not loged in

/* Redirect one page to anothe When user not loged in */
function redirect_to_specific_page() {
if ( is_page(96) && ! is_user_logged_in() ) {
wp_redirect( home_url(), 301 );
exit;
}
}
add_action( ‘template_redirect’, ‘redirect_to_specific_page’ );

Advertisements

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: