Remove p tags in wordpress posts

The WordPress implementation of the TinyMCE editor automatically adds <p> tags. There’s a few options for removing, as explained in a tutorial on removing <p> tags.

I would recommend the following approach, which is a slight modification from that tutorial (as it involves messing with core wp functions). Add the following code to your functions.php file which removes the auto <p>‘s:

function rm_wpautop($content) {
    global $post;
    // Remove the filter
    remove_filter('the_content', 'wpautop');
    return $content;
}

// Hook into the Plugin API
add_filter('the_content', 'rm_wpautop', 9);

Alternatively, if you only wanted to remove the auto <p> tags on specific posts or pages or other parts of your theme template, look for the line <?php the_content(); ?> in your template files and add <?php remove_filter ('the_content', 'wpautop'); ?> before it.