Logout Redirect

<?php
//Redirect subscribers to the referring page
function wco_redirect(){
if(current_user_can('editor')) return;
$logout_redirect_url = $_SERVER['HTTP_REFERER'];
if(!empty($_REQUEST['redirect_to'])) wp_safe_redirect($_REQUEST['redirect_to']);
else wp_redirect($logout_redirect_url);
exit();
}
add_filter('wp_logout','wco_redirect');
?>

0 Comments

You must be logged in to post a comment.