Title: Warning: Cannot modify header information when using require or require_once
Last modified: August 20, 2016

---

# Warning: Cannot modify header information when using require or require_once

 *  [Samuel](https://wordpress.org/support/users/samliem/)
 * (@samliem)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/warning-cannot-modify-header-information-when-using-require-or-require_once/)
 * 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

The topic ‘Warning: Cannot modify header information when using require or require_once’
is closed to new replies.

## Tags

 * [cannot modify header](https://wordpress.org/support/topic-tag/cannot-modify-header/)
 * [require()](https://wordpress.org/support/topic-tag/require/)
 * [require_once](https://wordpress.org/support/topic-tag/require_once/)

 * 0 replies
 * 1 participant
 * Last reply from: [Samuel](https://wordpress.org/support/users/samliem/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/warning-cannot-modify-header-information-when-using-require-or-require_once/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
