1

I am new to wordpress and am looking at a way to only allow users access to the front-end of my site. It is a one page vlog site, but I am forcing users to register to view.

Is this handled in wp-admin, htaccess? How would i handle this case?

EDIT
I am uploading a few videos to my site, and am creating a username and password for two different users that I will be providing them, that they must provide in order to access the site. Registration is not allowed, so basically only those 2 users and myself (the admin) will be able to access the site

0

You want users to Sign Up before they can see any page on your website?

If that's what you need then I think this is something I can do using jQuery.

Try adding this code to your footer.php in the very end before the tags.

<script>
jQuery(document).ready(function($){
if (!$("body").hasClass("logged-in")) {
window.location.replace("/register");
}
});
</script>

Now, what this code does? Basically every page in WordPress gets the class "logged-in" in the body tag when the user is logged in. So we check if the user is logged in and if they're not then simply redirect them to the register page.

Still need help? Contact me.

  • I am uploading a few videos to my site, and am creating a username and password for two different users that I will be providing them, that they must provide in order to access the site. Registration is not allowed, so basically only those 2 users and myself (the admin) will be able to access the site – user2676140 Sep 15 '18 at 21:45
  • I am not on fiverr -- but am on freelancer, are you? – user2676140 Sep 15 '18 at 21:46
  • @user2676140 No not actually on Freelancer though. You can sing in to Fiverr using Facebook. Or you can talk me on Twitter. twitter.com/wpcoderpro And yes what you're saying that can be attained. I can explain you more if you message me there as it will be too long and public here? :) – Afnan abbasi Sep 15 '18 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.