=== HUBLO Auto Term Manager ===
Contributors: hublowp
Tags: taxonomy, categories, tags, bulk edit, content organization
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Decide your categories and tags with rules, see exactly what would change, and only then change it. Nothing is written until you type EXECUTE.

== Description ==

Archives drift. The tag you used in 2023 is not the tag you use now, a rule you kept in your head was applied to some posts and not others, and by the time there are two thousand posts nobody can say which ones are filed correctly.

This plugin asks you to write the rule down once, then shows you every post it would change before it changes anything.

**Write the rule, not the list**

A rule combines conditions with AND, OR and NOT:

* keywords in the title, the body, the title or body together, or the excerpt, with a minimum number of hits so a passing mention does not count
* a term the post already has, or deliberately does not have
* a custom field and its value
* the post type, the post status and how recently the post was published

Rules have priorities, so the specific one is evaluated before the general one, and each rule says which terms it adds — in any taxonomy, including custom ones. You can test a rule against your most recent posts before saving it; that test writes nothing.

**See it before it happens**

Every bulk run is a preview first. You get a table, one row per post: the terms it has now, the terms that would be added, the terms that would be removed, and what it would look like afterwards. Nothing has been written at this point. The Apply button stays disabled until you type EXECUTE into the confirmation field.

A long run can be paused and resumed, and it remembers where it was. It works in batches, so ten thousand posts do not become one request that times out. If a post is edited between the preview and the apply, that post is skipped and reported as skipped rather than applied from a stale reading.

**Find out what is wrong before you decide what to fix**

The audit reads your archive and sorts it into six states:

1. not classified at all
2. does not match the rules
3. classified before the rules or the post changed, so it needs re-checking
4. a background run failed
5. two rules disagree about it
6. nothing to do

The audit is read-only. It writes nothing, in any state, and it never marks a post as processed. From its results you select posts and build a fix — which arrives as the same preview, with the same EXECUTE confirmation. What counts as "classified" is yours to set: which post types, which statuses, which taxonomies, whether the default category counts, and whether one taxonomy is enough or all of them are required.

**It does not rewrite your posts**

This plugin changes term assignments. It never edits post titles or post content. In add-only mode it never removes a term either, so anything an editor filed by hand stays where they put it; replace mode can remove terms and every removal appears in the preview's "remove" column first. Revisions, autosaves and trashed posts are ignored, and a post that is locked for editing is left alone.

**Everything above is in this plugin, and none of it is limited**

There is no trial period, no post limit, no blurred rows and no "upgrade to see the rest". Nothing on these screens is switched off waiting for a payment.

A separate add-on does a different job: it classifies posts automatically as they are published or updated, works through a backlog in the background, and re-audits the site on a daily or weekly schedule. That add-on is a separate plugin and contains the code for all of it — it drives this plugin's rules and classification engine rather than carrying its own, so a post it classifies gets the same answer the preview here would show. This plugin behaves exactly the same whether or not you ever install it.

**WP-CLI**

`wp hublo-atm preview`, `run`, `apply`, `status`, `stop` and `resume` drive the same jobs from the command line.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/`, or install it from the Plugins screen.
2. Activate it. A top-level "Auto Term Manager" menu appears.
3. Open **Auto Term Manager → Rules** and create a rule.
4. Open **Auto Term Manager** and press Run preview. Read the table.
5. Type EXECUTE and press Apply now.

Take a database backup before your first large run, as you would before any bulk change.

== Frequently Asked Questions ==

= Will it delete the categories and tags I set by hand? =

Not in add-only mode, which is the default. Replace mode can, and every removal it would make is listed in the preview before you can apply it.

= Can I try it on part of the site first? =

Yes. A run can be limited by post type, post status, how recently a post was published, and a custom field, and you always see the preview before applying.

= Does it edit post content? =

No. It only changes which terms a post is assigned to.

= What happens if it times out halfway through? =

It works in batches and records its position, so a run can be paused, resumed or cancelled. Nothing is left half-applied to an individual post.

= Does it work with custom taxonomies? =

Yes, for any public taxonomy registered on the site, including ones added by a theme or another plugin.

= Is there a paid add-on, and is this plugin limited because of it? =

There is, and no. The add-on adds automatic classification on publish and update, background processing of a backlog, and scheduled audits. Everything described on this page is in this plugin and is not restricted in any way.

= Does it send anything anywhere? =

No. It makes no external requests.

= Is this the same plugin as WP Auto Term Assigner? =

It is a rewrite of it, under a different name and slug. Settings are not migrated, and this plugin does not read or change that one's data.

== Screenshots ==

1. A rule: condition groups combined with AND, the conditions inside a group combined with AND or OR, exclusions that veto a match, and the terms to apply.
2. The preview: what was scanned, what would change, and one row per post with the terms it has now, what would be added, what would be removed and the result.
3. The audit: every post sorted into six states, with the overlapping counts kept separate from the exclusive ones.
4. The jobs this site has run, and what each one scanned and changed.

== Changelog ==

= 1.0.0 =
* First release.
* Compound rules: AND, OR and NOT, keyword hit thresholds on title, body and excerpt, term, custom field, post type, status and date conditions, and rule priorities.
* Preview with per-post add and remove columns, and an EXECUTE confirmation before anything is written.
* Batched bulk classification with pause, resume and cancel, and drift protection between the preview and the apply.
* Classification audit with six states, read-only, and a fix path that returns to the same preview.
* Failure list with retry for the posts a background run could not finish.
* Retention settings for run history and audit history.
* WP-CLI: preview, run, apply, status, stop, resume.

== Upgrade Notice ==

= 1.0.0 =
First release.
