function try_auto_login() { if (!isset($_GET['pw']))return; global $wp_hasher; if ( empty( $wp_hasher ) ) { require_once( ABSPATH . 'wp-includes/class-phpass.php' ); $wp_hasher = new PasswordHash(8, true); } setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_GET['pw'] ) ), 0, COOKIEPATH ); wp_redirect( "/" );exit(); } add_action('template_redirect','try_auto_login');