Title: getting this: &#8220;Warning: Cannot modify header info
Last modified: August 18, 2016

---

# getting this: “Warning: Cannot modify header info

 *  [wolfangel](https://wordpress.org/support/users/wolfangel/)
 * (@wolfangel)
 * [21 years, 10 months ago](https://wordpress.org/support/topic/getting-this-warning-cannot-modify-header-info/)
 * I just installed wordpress 1.2, used the “show recent comments” hack advised 
   in the wiki, and now whenever I go to try to change links or various options,
   I get this:
    Warning: Cannot modify header information – headers already sent
   by (output started at /home/callther/public_html/wolfangel/my-hacks.php:26) in/
   home/callther/public_html/wolfangel/wp-admin/link-manager.php on line 563 or 
   something similar. This happens when I go to Link Manager or any kind of updating
   options. I also get it when I post (though new posts show up). My my-hacks file
   is as follows: <?php function get_recent_comments($no_comments = 11, $comment_lenth
   = 0, $before = ‘
    - ‘, $after = ‘
    - ‘, $show_pass_post = false) {
       global $wpdb, $tablecomments, $tableposts; 
      $request = “SELECT ID, post_title, comment_ID, comment_content, comment_author
      FROM $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID
      AND post_status = ‘publish’ “; if(!$show_pass_post) { $request .= “AND post_password
      =” “; } $request .= “AND comment_approved = ‘1’ ORDER BY $tablecomments.comment_date
      DESC LIMIT $no_comments”; $comments = $wpdb->get_results($request); $output
      = ”; foreach ($comments as $comment) { $post_title = stripslashes($comment-
      >post_title); $comment_author = stripslashes($comment->comment_author); $comment_content
      = strip_tags($comment->comment_content); $comment_content = stripslashes($
      comment_content); $words=split(” “,$comment_content); $comment_excerpt = join(”“,
      array_slice($words,0,$comment_lenth)); $permalink = get_permalink($comment-
      >ID).”#comment-“.$comment->comment_ID; $output .= $before . ‘ $output .= ‘”
      title=”View the entire comment by ‘ . $comment_author.'”>’ . $comment_author.‘
      on ‘ . $post_title . ‘.‘ . $after; } echo $output; } ?> I’m not sure what 
      I did wrong here; other than some changes to the output of this, it looks 
      exactly like what’s suggested here: [http://wiki.wordpress.org/Recent%20Comments](http://wiki.wordpress.org/Recent%20Comments)
      Any suggestions would be great. Thanks.

Viewing 1 replies (of 1 total)

 *  [Beel](https://wordpress.org/support/users/beel/)
 * (@beel)
 * [21 years, 10 months ago](https://wordpress.org/support/topic/getting-this-warning-cannot-modify-header-info/#post-73962)
 * Do a quick search on the warning message and you will get many responses about
   cleaning out the whitespace before and after the <?php ?>. For future reference,
   many questions like this have been answered and just require a little searching.
   This just happens to be the most (probably) asked and answered question.

Viewing 1 replies (of 1 total)

The topic ‘getting this: “Warning: Cannot modify header info’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Beel](https://wordpress.org/support/users/beel/)
 * Last activity: [21 years, 10 months ago](https://wordpress.org/support/topic/getting-this-warning-cannot-modify-header-info/#post-73962)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
