Created
November 7, 2013 16:36
-
-
Save strangerstudios/7357594 to your computer and use it in GitHub Desktop.
Add ?loggedoutview=1 to the end of any URL to see what it looks like for logged out users.
This file contains hidden or 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
<?php | |
/* | |
Plugin Name: Logged Out View | |
Plugin URI: http://www.strangerstudios.com/wp/logged-out-view/ | |
Description: Add ?loggedoutview=1 to the end of any URL to see what it looks like for logged out users. | |
Author: Stranger Studios | |
Version: .1 | |
Author URI: http://www.strangerstudios.com | |
*/ | |
function lov_set_current_user() | |
{ | |
if(!empty($_REQUEST['loggedoutview'])) | |
{ | |
global $current_user; | |
if(!empty($current_user) && $current_user->ID > 0) | |
wp_set_current_user( 0 ); | |
} | |
} | |
add_action('set_current_user', 'lov_set_current_user'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Possible improvement:
(1) persisting the ?loggedoutview parameter (hint: use home_url and site_url hooks and add query arg())