I need an advice on how to the following: I have registered course custom post type and created one for example Course1. Course1 has child posts - some are private (e.g Lectures) and some are not.
When user tries to open Lectures user's meta field is checked and based on the value the content is displayed or the user is redirected to the parent. I have used template_redirect
hook (might not be the right one). What I need now is to show some banner with notification (for example you cant see private content) on parent course post after redirection. How can I know that user has tried to open Lectures and it was redirected? I tried using session in redirect function but didnt make it (the banner was active on all Course1 post). Could you please give me some advice? Thank you.