Hi @andresmolina
Maybe you could adjust this code snippet that redirects all users who don’t have an author role and visit single posts and users who have author role and who visit posts published after Dec 5:
add_action( 'template_redirect', function() {
global $post;
if(is_singular('post')) {
$user = wp_get_current_user();
if (! is_user_logged_in() || ( ! empty($user) && ( ! in_array( 'author', (array) $user->roles ) || ( in_array( 'author', (array) $user->roles ) && $post->post_date > '2021-12-05' ) ) ) ) {
$redirect = 'https://your-domain.com/unauthorized'; // Change this to the correct URL
wp_redirect( $redirect );
exit;
}
}
} );
To protect posts on the archive page, you’d need to adjust your loop and this would require developer help.
Kind regards