• I’m at my wits end here, I have a site that I’m trying to create. Now the site is fairly large and ran into the “Warning: Cannot modify header information – headers already sent by ” error. Once I hit this error I found lots of help mostly pointing to white space issues and after a lot of searching my files for this white space I decided to experiment. I backed my files up and deleted and reinstalled the entire WP applications from scratch. After doing that I edited the main “page.php” so that it now says “get_template_part( ‘template-parts/content’, ’emailhistory’ );”

    The content-emailhistory.php file looks like this:

    <form action="">
    <input id="send" name="submit" type="submit" value="Edit Email"><?php include 'EditEmailLandingPage.php' ?></form>
    </form>

    the EditEmailLandingPage.php looks like this:

    <?php
    $submitted = "true";
    wp_safe_redirect( 'thanks.html', 301 );
    exit;
    ?>

    I’m still getting the same error but with different files:

    Warning: Cannot modify header information – headers already sent by(output started at /xxx/xxx/xxx/xxx/xxx/xxx/header.php:13) in /xxx/xxx/xxx/xxx/pluggable.php on line 1171

    I’ve spent days trying to figure this out. I’m trying to implement the PRG standard. Is there something I’m doing wrong here?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator James Huff

    (@macmanx)

    The error is either present in header.php on line 13, or it’s being injected into header.php by way of pluggable.php, meaning it’s likely a plugin or theme function causing the trouble.

    If you have access to your admin panel, try deactivating all plugins. If you don’t have access to your admin panel, try manually resetting your plugins (no Dashboard access required). If that resolves the issue, reactivate each one individually until you find the cause.

    If that does not resolve the issue, try switching to the Twenty Sixteen theme to rule-out a theme-specific issue. If you don’t have access to your admin panel, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel, navigate to /wp-content/themes/ and rename the directory of your currently active theme. This will force the default theme to activate and hopefully rule-out a theme-specific issue.

    Thread Starter xavierblue

    (@xavierblue)

    I have done everything you mentioned…in fact I was already using the twenty-sixteen theme. Any other ideas? This is a fresh install without any new plugins or themes and only a few lines of code. I’m using this on a GoDaddy linux server.

    Moderator James Huff

    (@macmanx)

    Try downloading WordPress again, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel, and delete then replace your copies of everything on the server except the wp-config.php file and the /wp-content/ directory with fresh copies from the download. This will effectively replace all of your core files without damaging your content and settings.

    Some uploaders tend to be unreliable when overwriting files, so don’t forget to delete the original files before replacing them.

    Thread Starter xavierblue

    (@xavierblue)

    I will try this but my question for you is am I doing something wrong? I’m new to WP and using PHP. I’ve been coding for a long time and a lot of experience with other languages. I noticed that if I move my redirect above my get_header() code it works fine.

    Moderator James Huff

    (@macmanx)

    What you’re trying to modify isn’t a part of WordPress itself. It would be better to contact that plugin’s support specifically.

    What is the name of the plugin you’re modifying?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot modify header information’ is closed to new replies.