user access – Hide all pages except landing page


I’m working on a website that is still being built; however, the client would like to launch a landing page while it is being finished. What is the easiest way to make it so all the pages of the site are hidden from view except for the landing page to non-logged in users? (For logged-in users I’d like it to function normally so I can finish building the site.) I’d like the hidden pages to show a simple message or 404 in case someone happens to navigate to one, but nothing else (not the header, footer or menu). I figured there’d be a plugin for this, but alas, that doesn’t seem to be the case. Any help is appreciated!

in progress 0
Psychedelic Wizard 12 months 2021-10-06T00:35:40-05:00 0 Answer 0 views 0

Answer ( 1 )


    What I usually do in cases like this is add a condition in header.php that checks for logged in users, if user is not logged in I do get_template_part('some-template') then die;, in the template I create all my code, usually hard coded without wp_head() and wp_footer() (because this template doesn’t contain much code and don’t need to load WP resources).

Leave an answer