=== EffortLess Required Fields Validator ===
Contributors: domclic
Tags: posts, required-fields, featured-image, category, title
Requires at least: 5.8
Tested up to: 6.9
Stable tag: 1.4.13
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Donate link: https://id7.dev/donate/
Text Domain: effortless-required-fields-validator
Domain Path: /languages

Forces Title, Content, Featured Image and Category before publishing posts/pages in Gutenberg.

== Description ==

**Effortless Required Fields Validator** ensures content quality by requiring all users to complete essential fields before publishing posts and pages in the WordPress Gutenberg editor.

= Required Fields =

* **Title** - Post/page title must not be empty
* **Content** - Post/page content must not be empty
* **Featured Image** - A featured image must be set
* **Category** - At least one category must be selected (posts only)

= Features =

* **Works for all users** - Admins, Editors, Authors, and Contributors all have the same validation
* **Real-time validation** - Publish button is disabled until all required fields are filled
* **Visual feedback** - Warning message shows which fields are missing
* **Gutenberg optimized** - Seamless integration with the block editor
* **Multilingual ready** - Fully translatable with included French translation
* **Lightweight** - Minimal performance impact
* **Clean code** - Follows WordPress coding standards

= How It Works =

1. When editing a post or page, the plugin monitors all required fields
2. If any field is missing, the Publish button is automatically disabled
3. A prominent warning banner shows which fields need to be completed
4. Once all fields are filled, publishing is allowed
5. Server-side validation ensures posts cannot be published without required fields

= Use Cases =

* Maintain consistent content quality across your site
* Ensure all posts have featured images for better social media sharing
* Enforce editorial standards for multi-author blogs
* Prevent incomplete posts from being published accidentally
* Improve SEO by requiring complete content

= Translations =

* English (default)
* French (Français) - included
* Translation ready - submit your translations!

== Installation ==

= Automatic Installation =

1. Log in to your WordPress admin panel
2. Go to Plugins > Add New
3. Search for "Effortless Required Fields Validator"
4. Click "Install Now" and then "Activate"

= Manual Installation =

1. Download the plugin ZIP file
2. Log in to your WordPress admin panel
3. Go to Plugins > Add New > Upload Plugin
4. Choose the ZIP file and click "Install Now"
5. Activate the plugin

= After Activation =

The plugin works immediately after activation. No configuration needed!

Simply try to publish a post or page without filling all required fields, and you'll see the validation in action.

== Frequently Asked Questions ==

= Does this work with the Classic Editor? =

Yes! The plugin includes validation for both Gutenberg and the Classic Editor.

= Can I customize which fields are required? =

Currently, the plugin requires Title, Content, Featured Image, and Category (for posts). Customization options may be added in future versions based on user feedback.

= Does it work for custom post types? =

Currently, the plugin only validates the 'post' and 'page' post types. Support for custom post types may be added in future versions.

= Can admins bypass the validation? =

No. As of version 1.0.8, all users (including administrators) must complete all required fields before publishing. This ensures consistent content quality across your entire site.

= Will this affect my existing posts? =

No. The validation only applies when publishing new posts or updating existing ones. Your existing published posts remain unaffected.

= Does it work with Gutenberg blocks? =

Yes! The plugin is fully compatible with the Gutenberg block editor and all standard blocks.

= What happens if I try to publish without required fields? =

In Gutenberg, the Publish button will be disabled and a warning banner will show which fields are missing. In the Classic Editor, you'll see an error message with a link to return to editing.

= Is it translation ready? =

Yes! The plugin is fully translatable and includes French translation. You can add your own translations using the provided .pot file.

= Does it impact site performance? =

No. The plugin only loads its assets on post/page edit screens and has minimal performance impact.

== Screenshots ==

1. Warning banner showing missing required fields in Gutenberg editor
2. Disabled Publish button when required fields are missing
3. Validation error message in Classic Editor
4. All required fields completed - ready to publish

== Changelog ==

= 1.4.12 =
* Moved the support/donate message into a small plugin settings page.
* Added a Settings link in the plugin row. No donate notice is shown on the Plugins screen.

= 1.3.0 =
* **Rewritten:** JavaScript validation now uses `registerPlugin` with React hooks (`useSelect`, `useEffect`) — eliminates subscribe loop
* **Improved:** Uses `lockPostSaving`/`unlockPostSaving` via React lifecycle for proper publish blocking
* **Improved:** Warning banner rendered as a React portal component
* **Improved:** Gutenberg validation is fully client-side — removed REST API filters that caused false publish errors
* **Improved:** Simplified classic editor validation with cleaner function signature
* **Fixed:** Classic editor featured image detection on new posts via `$_POST['_thumbnail_id']`
* **Fixed:** Quick edit and bulk edit no longer trigger validation
* **Fixed:** `wp_die()` output sanitized with `wp_kses()`, back link uses `wp_get_referer()`
* **Fixed:** Removed unused CSS rules and assets
* **Added:** `Requires at least` and `Requires PHP` headers in main plugin file
* Release date: March 28, 2026

= 1.1.1 =
* **Fixed:** Server-side validation now works for pages in Gutenberg (added `rest_pre_insert_page` filter)
* **Fixed:** Featured image and category validation uses REST request payload instead of relying on unsaved post meta
* **Fixed:** Validation now falls back to stored post data when fields are not in the request payload
* **Fixed:** Publish status detection on updates to already-published posts
* **Fixed:** XSS risk in JavaScript warning banner (replaced innerHTML with safe DOM methods)
* **Improved:** Full WordPress Coding Standards (WPCS) compliance
* **Improved:** Yoda conditions, long array syntax, tab indentation, proper PHPDoc
* **Updated:** All translation files regenerated (POT, PO, MO, JSON) with correct line references
* **Tested:** Compatible with WordPress 6.9
* Release date: March 27, 2026

= 1.0.8 =
* **Changed:** All users (including admins) now have the same validation requirements
* **Added:** Proper text domain loading for better translation support
* **Fixed:** JavaScript translation support with JSON file generation instructions
* **Improved:** Code documentation and comments
* **Improved:** Emoji encoding in error messages
* **Updated:** Translation files (.pot and French .po)
* Release date: November 20, 2025

= 1.0.7 =
* Fixed all WordPress.org Plugin Check errors
* Fully standards-compliant i18n and security
* Release date: November 19, 2025

= 1.0.6 =
* Code cleanup and better validation
* Improved error handling

= 1.0.5 =
* Fixed role detection for Editor/Author/Contributor
* Better compatibility with different user roles

= 1.0.4 =
* Initial improvements and bug fixes

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.4.12 =
Moves the donate message to the plugin settings page. No validation logic changes.

= 1.3.0 =
Major rewrite: Gutenberg validation now uses React hooks (registerPlugin). Fixes subscribe loops and false publish errors. Classic editor validation simplified.

= 1.2.0 =
Uses official WordPress lockPostSaving API. Classic editor featured image fix. Quick/bulk edit compatibility. Plugin Check compliant.

= 1.1.1 =
Critical fix: Gutenberg validation now works correctly for pages and when updating published posts. WPCS compliant. Tested with WordPress 6.9.

= 1.0.8 =
Important update: All users (including admins) now require validation. Improved translation support for multilingual sites.

= 1.0.7 =
Recommended update for better WordPress.org compliance and security improvements.

== Developer Notes ==

= Filters Available =

Currently, the plugin doesn't provide filters for customization, but this may be added in future versions based on community feedback.

= Translation =

To translate this plugin:

1. Use the provided `.pot` file in the `/languages` folder
2. Create your translation using Poedit or similar tool
3. For JavaScript translations, compile JSON files using WP-CLI:
   `wp i18n make-json languages/ --no-purge`
4. Submit your translation to the plugin author

= Support =

For support, please use the WordPress.org support forums or visit the plugin's GitHub repository (if available).

== Privacy Policy ==

This plugin does not collect, store, or transmit any user data. It only validates post/page fields locally in the WordPress editor.

== Credits ==

Developed by domclic with ❤️ for the WordPress community.