Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Info about this Paste: https://wordpress.stackexchange.com/q/298596/137402
- function my_force_login() {
- $post = get_post(); // The current post.
- if (empty($post) || is_user_logged_in() || !is_singular()) return;
- $ids = array(1753, 109); // array of post/Page IDs or post/Page parent IDs that force login to read
- if (in_array((int)$post->ID, $ids) || in_array((int)$post->post_parent, $ids)) {
- auth_redirect();
- }
- }
Add Comment
Please, Sign In to add comment