• Hey!
    I′m facing a problem on my wordpress site that only occurs, when Phastpress is activated. Since Phastpress is really an amazing plugin, I would like to fix this issue so I can keep using it.

    When I load a certain page “domain/edit-listing” I get only some text elements from the footer displayed on a blank page – no background, menu or anything else loaded. And I can also not open that page (edit-listing) with Elementor, because it tells me that it doesn′t get a valid JS answer.

    The full warning message I get from the page trying to load is the following:
    Warning: Cannot modify header information – headers already sent by (output started at …/wp-content/themes/…/header.php:1) in /var/home/…/www/wp/wp-includes/pluggable.php on line 1296

    That one page (to edit an existing listing in my directory) won′t load since I get this warning about the header information. If Phastpress is off, it loads normally.
    I already tried to disable some options in the Phastpress setting, but only deactivating it completely stops the error.

    Any idea what is happening and how I can fix it? Or worst case how to deactivate phastpress on that page that can′t be loaded?

    Thanks in advance and keep up the great work!!

    • This topic was modified 4 years, 4 months ago by kuloko.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Albert Peschar

    (@kiboit)

    Hi @kuloko,

    This error indicates that there is some code in your theme or a plugin that tries to send headers after the page content has started outputting.

    Could you try to edit your theme functions.php and add this (inside the <?php and ?> tags):

    add_filter('template_redirect', function () {
      ob_start(null, 0, 0);
    });

    After that change, do you still experience the same issue?

    –Albert

    Thread Starter kuloko

    (@kuloko)

    Hello Albert!

    Thanks for responding so quickly.
    Well I added the code to the function.php (at the beginning of the document in line 2 right after the php tag) and now it indeed loads the page, but I′m facing another weird problem.

    The page is loaded twice (duplicated one on top of the other)
    So if I scroll all the way down, the whole page (including the navigation bar) shows again below the footer-area.

    Do you need any more information about this phenomenon, or do you have a clue why this is happening?

    THANKS!
    Matthias

    • This reply was modified 4 years, 4 months ago by kuloko.
    Thread Starter kuloko

    (@kuloko)

    And by the way:
    I still can′t open the page with elementor, because it gives me the “no valid JSON response” error
    (full error message in german: Aktualisierung fehlgeschlagen. Die Antwort ist keine gültige JSON-Antwort.)

    • This reply was modified 4 years, 4 months ago by kuloko.
    Plugin Author Albert Peschar

    (@kiboit)

    Hi @kuloko,

    I have no idea what is triggering this. It’s probably some code in a plugin or theme, but I don’t have enough information to see what the actual problem is.

    Would you be able to package up your site using Duplicator and send me the archive? I will then test with your site (including all plugins and your theme) and fix the issue. You will find my contact details at the bottom of the plugin description. For sending the file you can use WeTransfer.

    –Albert

    Thread Starter kuloko

    (@kuloko)

    Thanks a lot, Albert!

    I sent everything to your mail-adress!

    Plugin Author Albert Peschar

    (@kiboit)

    Hi @kuloko,

    Thanks for sending me the archive. I was able to reproduce the problem. It has to do with your theme wanting to send HTTP headers after the page has already started rendering. This doesn’t work with PhastPress because PhastPress starts sending output as soon as possible, and this requires redirects to be done before the page starts rendering.

    With this code the problem is actually fixed:

    <?php
    add_action('template_redirect', function () {
        ob_start();
    });

    The code that I sent you earlier has additional parameters to ob_start that cause the double output issue.

    In order not to have to edit the theme (and break updates), you can insert this code in a new PHP file in a new directory wp-content/mu-plugins/. Or you may download this ZIP file and upload the contents. This should fix the issue.

    If not, please let me know. And if PhastPress works well for you, I’d really appreciate it if you left a review here.

    –Albert

    Thread Starter kuloko

    (@kuloko)

    You′re a genius!
    Problem fixed and it works like a charm.

    10 Stars! ??

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