Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created October 9, 2012 07:55
Show Gist options
  • Save corsonr/3857246 to your computer and use it in GitHub Desktop.
Save corsonr/3857246 to your computer and use it in GitHub Desktop.
Restrict Content Pro - automatic redirection
// 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' );
@kronda
Copy link

kronda commented Jul 22, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment