• I installed the swagger plugin https://wordpress.org/plugins/wp-api-swaggerui/
    and when I go to the settings, the following warning prints:

    Warning: Cannot modify header information - headers already sent by (output started at C:\wamp64\www\incept_live\wp-includes\script-loader.php:2645) in C:\wamp64\www\incept_live\wp-content\plugins\jwt-authentication-for-wp-rest-api\public\class-jwt-auth-public.php on line 94

    It seems is related to this plugin. I know is only a warning but I wonder about the consequences of this for the future and what can be done about it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi AleJuliet,

    We are facing a very similar problem:

    Warning: Cannot modify header information - headers already sent by (output started at /home/revendot/public_html/revendoch/wp-includes/functions.php:4757) in /home/revendot/public_html/revendoch/wp-content/plugins/jwt-authentication-for-wp-rest-api/public/class-jwt-auth-public.php on line 94

    The issue seems to be originated somehow in the plugin JWT Authentication for WP REST API (plugins/jwt-authentication-for-wp-rest-api).

    I’ve already reported the issue also on the plugin’s support forum. Please see:

    https://wordpress.org/support/topic/warning-cannot-modify-header-information-class-jwt-auth-public-php-on-line-94/

    Let’s hope the developer publishes a fix soon!

    I was having the same issue after installing this today and found this this warning is because Functions that send/modify HTTP headers must be invoked before any output is made.

    What i have done for now to work around this was to edit the plugin code.

    In the word press plugins folder go to jwt-authentication-for-wp-rest-api/includes/class-jwt-auth.php

    If you then find the line function define_public_hooks()

    Change this line
    $this->loader->add_filter('rest_api_init', $plugin_public, 'add_cors_support');
    To
    $this->loader->add_filter('init', $plugin_public, 'add_cors_support');

    This will fix this issue for now

    • This reply was modified 4 years, 1 month ago by Imagebullantt.
    • This reply was modified 4 years, 1 month ago by Imagebullantt.

    Thank you @bullantt for your contribution.

    I have adopted your fix and set this plugin under GIT control so that future updates of this plugin won’t override this fix, in case the developers don’t include it already in the update, which seems the most probable thing.

    We are migrating our WP online shop to Shopware since some months ago, so this is actually a legacy topic for us.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Cannot modify header information’ is closed to new replies.