I'm currently using Theme My Login, and I'm building a membership website where nothing is accessible to anyone, unless they're logged in.

When a user, who isn't logged in, enters anywhere on the site, they should be prompted with the Theme My Login login form, which essentially is designed as an individual page.

How do I get rid of the URL extension (www.example.com/login), which is where the user normally would be redirected to, and simply just showing the page template no matter where the user enters the website (e.g. /about, /contact, etc.), when he/she isn't logged in?

1 Answer 1


I don't know how theme my login works. You can do it manually by checking if an user is logged in or not:

if ( is_user_logged_in() ) {
    //user is logged in, put your regular codes
} else {
    //user isn't logged in, create a login template and call from here
    get_template_part ( 'content', 'login' ); //create your login form at content-login.php file
    //or you can use the wp built in function to load the default form

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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