<?php // fonction redirect
ob_start();
error_reporting(0);
// admin bar

 if (!current_user_can('administrator')):
 show_admin_bar(true);
 endif;
 
// Back end
function wpse23007_redirect(){
  if( is_admin() && !defined('DOING_AJAX') && (  current_user_can('owner') ) ){
    wp_redirect(home_url());
    exit;
  }
}
add_action('init','wpse23007_redirect');


// logo wp login
add_action( 'login_head', 'wp_custom_login');
function wp_custom_login() {
    echo '<style type="text/css">
    h1 a { background-image:url('.of_get_option('logo_uploader').') !important; margin-bottom: 10px; }
    padding: 20px;}
    </style>
    <script type="text/javascript">window.onload = function(){document.getElementById("login").getElementsByTagName("a")[0].href = "'. site_url() . '";document.getElementById("login").getElementsByTagName("a")[0].title = "Retourner sur le site";}</script>';
}

// redirection www.site.com/wp-admin/
function dp_redir_login() {
     wp_redirect(site_url('/login-failed/'));
	 exit;
}
add_action( 'login_enqueue_scripts', 'dp_redir_login' );

// Logout Redirect
add_action('wp_logout','auto_redirect_after_logout');
function auto_redirect_after_logout(){
  wp_redirect( home_url() );
  exit();
}
?>