I will be doing upgrades to the design and content of my WordPress site. During this time I only want the homepage to be available. Is there a good way to lock this down (through a plug-in, etc.).
I’m having trouble coming up with answers from Google.
Thanks,
Jason
2 Answers
Here is a little snipit of code that I used for my site while it was under construction
<?php
/* ROUGH METHOD OF DENY ACCESS */
$underconstruct = array(121, 46, 124, 97);
if(!is_user_logged_in() && !in_array(get_the_ID(), $underconstruct)) {
wp_redirect(get_permalink(121));
exit();
}
?>
I put this at the top of my header.php
.
the $underconstruct array is the page/post ids that all not logged in users can see. If they are not logged in and are not on one of the pages that they should be, they get redirected. If the user is logged in, then everything will proceed as normal.