Created
October 9, 2012 07:55
-
-
Save corsonr/3857246 to your computer and use it in GitHub Desktop.
Restrict Content Pro - automatic redirection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// redirection if user is logged in | |
function rcp_redirect_if_user_is_logged() { | |
if (is_plugin_active('restrict-content-pro/restrict-content-pro.php')) { | |
if( is_user_logged_in() ) { | |
wp_redirect( home_url() ); // replace home_url() by whatever url/page you want | |
exit; | |
} | |
} | |
} | |
add_action( 'rcp_after_login_form', 'rcp_redirect_if_user_is_logged' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey. Thanks for sharing this. This is exactly what I'm looking for but I can't get it to work. I added this to my functions.php file, do I need to put it somewhere else? I'm using RCP version 1.5.7 and WP 3.5.2