Empty P Tag

Description

Empty P Tag helps you keep clean front-end markup when WordPress, themes, or builders insert unwanted empty <p> / <br> tags that create awkward spacing.

What it does

  • Removes empty paragraph tags (including whitespace-only and &nbsp; paragraphs)
  • Optionally disables WordPress wpautop on content, excerpts, and text widgets
  • Gives you a Settings screen so you can choose exactly where cleanup runs
  • Stays lightweight: front-end cleaning runs only where you enable it

Useful when

  • Page builders or custom HTML layouts pick up extra vertical space
  • Classic editor / mixed content leaves empty paragraphs behind
  • You want wpautop off in some places, but normal paragraphs elsewhere

Default settings match older versions of this plugin, so existing sites keep the same behavior after upgrading.

Release Notes

Version 5.0.0 – Major update

This release rebuilds Empty P Tag around a proper settings experience while keeping the previous default behavior for existing sites.

Highlights

  • New admin page at Settings Empty P Tag
  • Turn WordPress automatic paragraphs (wpautop) on or off for content, excerpts, and text widgets
  • Choose where empty paragraph cleanup should run
  • Improved matching for empty paragraphs that contain only spaces, &nbsp;, line breaks, or invisible characters
  • Option to also remove empty paragraphs that include HTML attributes (for example a class)
  • Optional setting to collapse consecutive / stray line break tags
  • Quick Settings link on the Plugins screen
  • Translation-ready (text domain: empty-p-tag)
  • Settings are removed cleanly on uninstall
  • Compatibility updates: requires PHP 7.2+, tested up to WordPress 6.8

Upgrade notes

  • After updating, review Settings Empty P Tag
  • Defaults match the older always-on behavior, so most sites will look the same after upgrade
  • If your theme needs normal WordPress paragraphs, disable the wpautop options and leave empty-tag cleanup enabled

Installation

From the WordPress admin

  1. Go to Plugins Add New.
  2. Search for Empty P Tag.
  3. Click Install Now, then Activate.
  4. Open Settings Empty P Tag to review options.

Manual install

  1. Upload the empty-p-tag folder to /wp-content/plugins/.
  2. Activate Empty P Tag from the Plugins screen.
  3. Configure options under Settings Empty P Tag.

FAQ

Will this change my posts immediately?

Yes on the front end. The plugin filters rendered content; it does not rewrite post content in the database.

Does this disable all paragraph formatting?

Only if those options stay enabled. You can turn off wpautop removal per area (content, excerpt, widgets) and still strip empty tags.

I upgraded and my layout looks different

Open Settings Empty P Tag and restore the defaults, or disable only the option that conflicts with your theme.

Can developers customize cleanup?

Yes. Filters include haq_empty_p_tag_should_clean and haq_empty_p_tag_cleaned_content.

Reviews

ജൂൺ 19, 2020
I tried this as a last resort to try to improve the formatting of my commenting system, wpDiscuz (https://wordpress.org/plugins/wpdiscuz/), which by the way is great! Unfortunately in my case (because I need to select only one or two words sometimes) it kept adding <p> tags to the text, which added line breaks and unwanted spacing. This plugin solved that problem!
ഒക്ടോബർ 11, 2017 1 reply
I love this plugin. It really work fine.
Read all 7 reviews

Contributors & Developers

“Empty P Tag” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Empty P Tag” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

5.0.0

  • Major rewrite with a Settings screen (Settings Empty P Tag)
  • Choose where to disable wpautop (content, excerpt, widgets)
  • Choose where empty paragraph cleanup runs
  • Stronger empty-tag matching (&nbsp;, zero-width spaces, attribute-bearing empty paragraphs)
  • Optional collapse of extra <br> tags
  • Plugin action link to Settings
  • Translation-ready text domain
  • Clean uninstall that removes stored settings
  • Requires PHP 7.2+, tested with modern WordPress

4.1

  • Internal maintenance release

3.0

  • WordPress.org compatibility updates

2.0.1

  • Third release
  • Added feature to remove whitespace-only paragraph tags

1.0.1

  • Second release
  • Added preg_replace cleanup for empty tags

1.0.0

  • First release
  • Basic plugin