=== Export Pattern & Block Location ===
Contributors: lruizcode, bubuku
Donate link: https://www.bubuku.com/
Tags: gutenberg, blocks, patterns, csv, export
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Find where any CSS class, block or pattern is used across your site and export every location to CSV before you change or remove it.

== Description ==

You want to remove a deprecated CSS class, retire a custom block or update a pattern, but WordPress has no way to tell you which posts and pages still use it. Searching by hand through hundreds of entries is slow, and the one you miss ends up broken after the change.

Export Pattern & Block Location scans your content for the CSS classes, blocks and patterns you name, shows every match in a table and lets you download the list as a CSV file.

= Find it before you change it =

* Search CSS classes, Gutenberg blocks (including nested ones) or patterns by slug.
* Enter several terms at once, separated by commas.
* Each result shows the post, its type and status, and how many times the term appears.
* Posts link straight to the editor.

= Share the results =

* Download the matches as a CSV that opens correctly in Excel and Google Sheets.
* Cells that start with `=`, `+`, `-` or `@` are neutralised, so a post title can never run as a spreadsheet formula.

= Built for large sites =

* Only posts that can contain your term are loaded, so searches stay fast on big sites.
* The API lets you limit the scan by post type, status and, with WPML, language.

= For developers =

* A REST endpoint (`/wp-json/epbl-search/v1/run`) returns CSV or JSON for automation and audits.

Ideal for developers, agencies and site administrators who need a reliable content inventory before a redesign, theme change or plugin update.

== Installation ==

1. Upload the `export-pattern-block-location` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to Tools > Export Pattern & Block Locations.
4. Choose what to look for, enter one or more terms and click Search.

== Screenshots ==

1. Search form with the Gutenberg Blocks type selected and the terms to look for.
2. Results table listing every post that uses the searched blocks, with the Download CSV button.
3. Results of a CSS class search, showing how many times each class appears in each post.
4. A search in progress on a large site: a progress bar shows the current batch, matches appear as they are found, and Cancel keeps the partial results.

== Frequently Asked Questions ==

= What content is searched? =

The content of all public post types that use the editor (posts, pages and custom post types). You can limit it by post type and status through the API.

= Does it search nested blocks? =

Yes. Blocks inside groups, columns and other containers are found at any depth.

= Does it find every pattern? =

It finds content that records the pattern name. Patterns inserted as plain blocks without a recorded name cannot be detected.

= Can I use it with WPML? =

Yes. You can search all languages or a single one.

= How do I authenticate API requests? =

Log in as an administrator, or define a token in `wp-config.php`: `define( 'EPBL_ACCESS_TOKEN', 'your-long-random-token' );` and pass it as `?token=`. Without that constant, token access is disabled.

== Privacy Policy ==

The plugin does not store personal data, add cookies or send anything to external servers. Searches run on your site and the CSV is generated in your browser.

== Support ==

**Need help or have a suggestion?**
Please use the [official WordPress.org Support Forum](https://wordpress.org/support/plugin/export-pattern-block-location/) for any issues related to the plugin.
    
**Want to know more?**
Before making a change to your theme, find out where the elements are used: the [plugin page](https://plugins.bubuku.com/plugins/export-pattern-block-location/) explains how it works, what it records and what it deliberately leaves out. For anything else, or to get in touch with the development team, visit our [official website](https://www.bubuku.com/).

**Like the plugin?**
Please [leave a 5-star review](https://wordpress.org/support/plugin/export-pattern-block-location/reviews/?filter=5) and help others discover Export Pattern Block Location.

== Development ==
This plugin uses a build process to generate the JavaScript and CSS files
distributed in `assets/build/`.

The original, human-readable source files are available in the
`assets/src/` directory included in this plugin.

== Changelog ==

= 1.0.3 =
* Searches now run in batches with a progress bar and a Cancel button that keeps the partial results; a failed batch is retried once.

= 1.0.2 =
* Security hardening and much faster searches on large sites.

= 1.0.1 =
* Redesigned admin page with a results table; Search and Download CSV are now separate steps.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.3 =
Large searches no longer run as a single request: they show progress and can be cancelled.

= 1.0.2 =
Security hardening. If you use the API token, define `EPBL_ACCESS_TOKEN` in wp-config.php; the old default no longer works.
