Created
March 31, 2022 17:23
-
-
Save hyptx/914c6988294b7ec4feb6087f904cf922 to your computer and use it in GitHub Desktop.
Redirect certain pages for development
This file contains 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
//TEMP REMOVE GO LIVE | |
function redirect_if_user_not_logged_in() { | |
global $post; | |
$show_live_pages = [3,46]; | |
if(in_array($post->ID, $show_live_pages)) return; | |
if(is_admin()) return; | |
if (!is_user_logged_in() && !is_front_page()) { | |
wp_redirect( 'https://northernfeedandbean.com'); | |
exit; | |
} | |
} | |
add_action( 'template_redirect', 'redirect_if_user_not_logged_in' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment