Title: Remove tags from HTML comments only
Last modified: October 25, 2016

---

# Remove tags from HTML comments only

 *  [annabh](https://wordpress.org/support/users/annabh/)
 * (@annabh)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/remove-tags-from-html-comments-only/)
 * Whenever I add an HTML comment into the text editor:
 * <!– comment here –>
 * Wordpress adds <p></p> tags before and after the comment, even if I strip out
   all spaces:
 * text<!– comment here –>text
 * I’ve tried this:
 * remove_filter( ‘the_content’, ‘wpautop’ );
    remove_filter( ‘the_excerpt’, ‘wpautop’);
 * It works great, except it removes the spaces throughout my site, and it’s too
   much work to go in every page to add them back in. Any thoughts for removing 
   the <p> tags from comments only?

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

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/remove-tags-from-html-comments-only/#post-8354146)
 * What theme are you using?
 *  Thread Starter [annabh](https://wordpress.org/support/users/annabh/)
 * (@annabh)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/remove-tags-from-html-comments-only/#post-8354166)
 * A theme I built. I’ve had this problem with themes my other developer built as
   well.
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/remove-tags-from-html-comments-only/#post-8354447)
 * – These forums are for free themes/plugins available in the WordPress theme directory
   at wordpress.org/themes/. Forum volunteers are not given access to custom products,
   so they would not know why your custom/commercial theme or plugin is not working
   properly.
    See [http://codex.wordpress.org/Forum_Welcome#Commercial_Products](http://codex.wordpress.org/Forum_Welcome#Commercial_Products)

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

The topic ‘Remove tags from HTML comments only’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/remove-tags-from-html-comments-only/#post-8354447)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
