Last active
November 4, 2020 21:02
-
-
Save lynt-smitka/935a6b28fcdbc7555277aa7075b6733f to your computer and use it in GitHub Desktop.
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
function lynt_redirect_to_login(){ | |
if ( is_page(123) && !is_user_logged_in() ) auth_redirect(); | |
} | |
add_action('get_header', 'lynt_redirect_to_login'); | |
// in_category('private-category') - test if the current post exists in particular category | |
// wp_get_post_parent_id(get_the_ID()) === 2 - test if the current page is the child of the page defined by its ID | |
// get_current_user_id() === 3 - test if the current user is the specific user defined by his ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment