Empty P Tag

By Husain Ahmed

★ 5.0/5 (3 ratings)700+ active installationsVersion 6.0.0

Remove empty paragraphs and fix awkward spacing without breaking your layout.

Description

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

The problem

Empty paragraphs and stray breaks often appear after pasting content, mixing classic and block markup, or using WYSIWYG fields. They push layouts apart and are hard to spot in the visual editor.

What it does

  • Removes empty paragraph tags (including whitespace-only and &nbsp; paragraphs)
  • Optionally disables WordPress wpautop on content, excerpts, and text widgets
  • Cleans comments, term descriptions, and Advanced Custom Fields (optional)
  • Limits cleanup by post type or excluded post IDs
  • Lets you skip cleanup on a single post/page
  • Optional per-post clean-on-save for permanent database cleanup (off by default)
  • Live Before → After HTML preview on the settings screen
  • One-click presets: Recommended (safe), Classic, or Aggressive

Safety first

Front-end cleanup is non-destructive: the plugin filters rendered output and does not rewrite post content in the database unless you explicitly enable clean-on-save on a post.

Useful when

  • Classic editor / mixed content leaves empty paragraphs behind
  • Comment systems or WYSIWYG fields add extra vertical space
  • You want wpautop off in some places, but normal paragraphs elsewhere
  • You need ACF WYSIWYG output without empty spacer paragraphs

Page builders

Plugins like Elementor often render outside the_content. Empty P Tag cleans WordPress content filters (posts, excerpts, widgets, comments, terms, ACF). It does not rewrite every builder canvas.

Privacy

This plugin does not collect, store, or send personal data. There is no telemetry.

Developers

Filters include:

  • haq_empty_p_tag_settings
  • haq_empty_p_tag_should_clean
  • haq_empty_p_tag_before_clean
  • haq_empty_p_tag_clean_pattern
  • haq_empty_p_tag_cleaned_content

Release Notes — Version 6.0.0

This release turns Empty P Tag into a clearer, safer, more flexible cleanup tool while keeping older sites stable.

What’s new

  • One-click presets: Recommended (safe), Classic Empty P Tag, and Aggressive spacing fix
  • Live Before → After HTML preview on the settings screen
  • Cleanup for comments, category/term descriptions, and optional ACF fields
  • Limit cleanup by post type or excluded post IDs
  • Per-post Skip cleanup control (classic editor + block editor sidebar)
  • Optional per-post clean-on-save (off by default — only rewrites the database when you choose it)
  • Safer cleaner: optional HTML tag balancing, configurable filter priority
  • Multisite-aware uninstall and updated WordPress.org documentation/assets
  • Requires PHP 7.4+, WordPress 5.8+, tested up to WordPress 7.1

Upgrade notes

  • Existing sites keep classic defaults for missing settings so layouts should not suddenly change
  • New installs get the Recommended (safe) preset: empty-tag cleanup on, wpautop left alone
  • After updating, open Settings → Empty P Tag and review the active preset

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 and choose a preset.

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 in the database?

No by default. Front-end filters clean rendered HTML only. Permanent changes happen only if you enable clean-on-save and check that option on a specific post.

Does this disable all paragraph formatting?

Only if those options stay enabled. Use the Recommended (safe) preset to keep wpautop on and still strip empty tags.

Does it work with the Block Editor (Gutenberg)?

Yes. Cleanup runs on rendered content. Per-post skip / clean-on-save controls appear in the document sidebar when enabled.

Does it support ACF?

Yes. Enable the ACF WYSIWYG (and optionally textarea) toggles under Integrations.

Will it fix Elementor / Divi spacing?

Not fully. Those builders often bypass the_content. Use Empty P Tag for WordPress content areas; for builder canvases, prefer the builder’s own spacing controls or CSS.

I upgraded and my layout looks different

Open Settings → Empty P Tag and apply Classic Empty P Tag, or turn off only the option that conflicts with your theme. Existing installs keep previous defaults for missing keys.

Can developers customize cleanup?

Yes. See the developer filters listed in the Description.

Screenshots

Changelog

6.0.0

  • Major feature release: presets, live preview, broader cleanup surfaces, and safer new-install defaults
  • Presets: Recommended (safe), Classic Empty P Tag, Aggressive spacing fix
  • Live HTML Before → After preview on the settings screen
  • Cleanup for comments, term descriptions, and optional ACF fields
  • Post type targeting and exclude post IDs
  • Per-post skip control (classic meta box + block editor panel)
  • Optional per-post clean-on-save (off by default; rewrites stored content only when checked)
  • Optional force_balance_tags (off for new installs; existing classic behavior preserved)
  • Configurable cleanup filter priority
  • Developer filters for settings, pattern, and before/after clean
  • Multisite-aware uninstall across all blogs
  • Requires PHP 7.4+, WordPress 5.8+, tested up to WordPress 7.1
  • Translation template (languages/empty-p-tag.pot)
  • Fresh WordPress.org icon, banner, and screenshots

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