Removing P Tags in WordPress

By default, WordPress will automatically inserts p tags throughout your content. This can seriously screw up the layout/design and cause validation issues. There are a couple of ways to fix this, depending on your technical expertise and where you would like to prevent this from taking place.

Here are three options:

  1. Throughout entire site
  2. On specific template pages
  3. With specific page items

Throughout your entire site:

Here’s a quick and easy fix to stop WordPress from placing p tags anywhere within your site. You will need to open your /wp-includes/default-filters.php file and comment out the following line:
addfilter('the_content', 'wpautop');

To comment out a line in a PHP file, insert two forward slashes //  in front of the line. When you’re done, this is how it should look:
//addfilter('the_content', 'wpautop');

On specific template pages:

This method allows you to stop WordPress from using theses tags on specific template pages (i.e. page.php, home.php, index.php, or any custom template page). You’ll need to open the page in an editor such as the built in WordPress editor or Dreamweaver.

<?php the_content(); ?>

and place this directly above:
<?php remove_filter (’the_content’, ‘wpautop’); ?>

it should look like this:
<?php remove_filter (‘the_content’, ‘wpautop’); ?>
<?php the_content(); ?>


By capitalizing on conversion-centric email marketing, social media, online giveaways, and abandoned cart emails, we significantly increased brand loyalty, awareness, and most importantly—eCommerce sales.

  • Digital strategy and tactic ideas
  • Website optimization tips
  • Download case study

    With specific page items (pics, field labels, content):
    This one is also fairly easy. While creating a page or post within WordPress, you have the ability to type in either the “Visual” or “HTML” tab. Feel free to create the post in visual, but when you’re done, you’ll need to switch over to HTML. Locate the item you’d like to remove the <p> tag on, and place <div> tags around it instead. You’ll need to make sure that you place div tags around each item for this to work. Below is an example:

    <div>Example Item</div>

    Need more digital marketing help? Contact us! We specialize in maximizing conversions and increasing our client’s ecommerce sales.

    See what we can do for you: email byrd@redrokk.com or call (360) 747-7401.