WordPress.org

Ready to get started?Download WordPress

Forums

Warning: Cannot modify header information when using require or require_once (1 post)

  1. Samuel
    Member
    Posted 1 year ago #

    Hi, I'm WordPress newbie.

    I'm creating a plugin that redirect to custom login page each unregistered user access a website, let say the custom login page : custom_login.php.

    I am able to create a code to redirect it but it seems no wordpress functions work in custom_login.php. So, I think I have to load something through the file. I guess wp-load.php.

    Then I add some codes below at the top of the page :

    <?php
    require( 'd:\xampp\htdocs\wordpress\wp-load.php' );
    ?>

    But then I got this error :
    Warning: Cannot modify header information.....

    I changed to require_once but still get similar error.

    Some solutions of this forum threads advice to delete any whitespace. Frankly, I don't know what does it mean but I tried to delete all whitespace anyway so that the code become :

    <?php require('d:\xampp\htdocs\wordpress\wp-load.php');?>

    But it does not solve anything. The error is still exist.

    Please help me, the expert ones.
    Thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Topic