Support » Fixing WordPress » Warning: Cannot modify header information – headers already sent by

  • Resolved Immow


    Hello I get this error when I installed a plugin:
    Warning: Cannot modify header information – headers already sent by (output started at C:\xampplite\htdocs\wp-content\themes\jillij-1\header.php:5) in C:\xampplite\htdocs\wp-includes\pluggable.php on line 275

    The plugin restricts access to a page that I specify, this error only occurs when clicked on restricted page, normally a user would be redirected to login/registration page.I tried many restriction plugins and this one seems to work the best for me.

    I checked for spaces before <?php and ?> behind them in pluggable.php (its the original file no changes made here).
    I checked this for my theme jillij-1 header.php from my theme.

    plugin source:
    jillij-1 header.php source: (click view source)
    Pluggable.php is original file so that should not be the problem.

    I await your enlightenment.

Viewing 5 replies - 1 through 5 (of 5 total)
  • whooami



    The comments for this on the plugin author’s site mention this error, have you read those specific comments?

    Unless you downloaded this from somewhere else, since the file on the author’s site differs from yours slightly — and the code changes are also suggested within other comments (note that those arent changes that necessarily fix your problem, I just noticed that the files are different).

    Its bad form and unwise to download plugins if you’re not actually getting them from the person that wrote the plugin, btw, especially if you’re not familiar with PHP — you never know what you might end up

    Without those changes the plugin would not show my pages that I could restrict.




    I understand that — thats why I said what I said about the changes NOT being related to the issue in this post.

    Since you have made those changes —

    1. You took the changes off the comments on the authors site?

    (Yes): Yes, you did, but you didnt read the _other_ comments.

    (Yes): Yes, you did, AND you did read the _other_ comments and they didnt help.

    (No): No you did not, so you are not aware of any comments. (this is where my remark about picking up plugins “any ole place” comes from)

    See where I’m going with this?

    After reading like 50 posts I manged to change the code so that it works.

    Source can be found here of my working page restriction code:

    If this page is dead then you can look at the comments at author site for the solution. I combined the following suggestions in comments from

    ####Part 1####
    Line 81:
    WHERE $wpdb->posts.post_type = ‘page’

    Line 85:
    $posts = $wpdb->get_results(“SELECT $wpdb->posts.* FROM $wpdb->posts WHERE post_type = ‘page'”);

    Line 123:
    $pages = $wpdb->get_results(“SELECT * FROM $wpdb->posts WHERE post_type = ‘page’ ORDER BY menu_order”);

    Then my pages appear under Options > Page restriction and I’m able to select the pages that require a logged-in user. When that page is selected in the menu, user is immediately taken to the login screen.
    ####part 2####
    You find this code at the bottom

    add_action(‘wp_head’, ‘check_the_user’);
    add_action(‘template_redirect’, ‘check_the_user’);

    I like to thank whooami for pointing out the power of reading.

    I like to add that a friend of mine claimed using opera it takes a long time to load the pages (I use a drop down menu theme) where one pages is restricted. Second strange thing is the plugin is gone from plugins in wordpress but I can still use the plugin-restriction admin pannel

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Warning: Cannot modify header information – headers already sent by’ is closed to new replies.