=== Empty P Tag ===
Contributors: husainahmedqureshi
Tags: wpautop, formatting, editor, excerpt, filter
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.2
Stable tag: 5.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Remove empty paragraph and break tags, and optionally disable WordPress automatic formatting (wpautop).

== 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.

== 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**.

== Frequently Asked Questions ==

= 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`.

== Screenshots ==

1. Settings page with wpautop and cleanup options.

== 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

== 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

== Upgrade Notice ==

= 5.0.0 =
Adds a settings page and safer, more configurable cleanup. Defaults keep previous behavior. See Release Notes for full details.
