WordPress.org

Ready to get started?Download WordPress

Forums

Functions.php in Child Theme Not Working Properly (1 post)

  1. Sanphorii
    Member
    Posted 1 year ago #

    Hi, everyone. I have a fresh WP installed, and I also am running a child theme. In the child theme folder, I have a Functions.php file with nothing in it except the code below:

    <?php
    if ( !is_user_logged_in() ) {
    		header("location: wp-login.php");
    }
    ?>

    That code is supposed to take me to the wp-login.php if I'm not logged in, but instead the page loops the redirect, then brings give me the error that tells me that it can't run because the redirect has happened too many times unsuccessfully.

    Does anyone know why this might be happening, or how I can get simply show the login screen on the index page for people that are not logged in? I don't want anybody being able to access anything on the website without logging themselves in.

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic