=== oakenbit Term Tree Creator ===
Contributors: oakenbit
Tags: categories, tags, taxonomy, bulk, hierarchy
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

Paste an indented outline and create a whole category tree at once, or a list of tags. Preview first, undo with one click.

== Description ==

A new blog, shop or knowledge base often needs a category structure before the first post: topics, subtopics, a dozen tags. Adding them one by one on the Categories screen, then picking the right parent for each, takes a long time. With oakenbit Term Tree Creator it takes one step.

Type or paste an outline, one name per line. Indent a line to make it a child of the line above. The plugin shows you a preview of the tree, then creates every term with the right parent and slug.

    News
        Company news
        Product updates
    Guides
        Getting started | getting-started
        Advanced
    Reviews

= What it does =

* **Nested categories in one go.** Any depth. Indent with spaces or tabs, or use leading dashes ("-", "--") if you prefer.
* **Preview before anything is saved.** A table shows every name, its level, its slug and whether it is new or already exists.
* **No duplicates.** Terms that already exist with the same name and parent are reused, so you can run an outline again later to add missing terms, or add children under an existing category.
* **Custom slugs.** Write `Name | my-slug` to set the slug.
* **Start under any term.** Put the whole outline under an existing parent category.
* **Any taxonomy.** Categories, tags, and the taxonomies of other plugins and themes. Hierarchical taxonomies keep the tree; flat ones such as tags get a plain list.
* **One-click undo.** Every run is logged. "Undo" deletes exactly the terms that run created, and only those that no content uses yet.
* **Pasting from documents works.** List bullets (-, *, •) and non-breaking spaces from word processors are handled.

= Built to stay out of the way =

* No settings page, no ads, no upsell notices.
* No external requests, no tracking, no cookies. The plugin never contacts any server.
* Only users who can manage categories see the screen, and the plugin checks the right capability for every taxonomy, parent and term.
* Uninstalling removes the plugin's own data (run log, preferences, markers). The terms you created stay.

= How to use =

1. Go to **Posts > Terms from Outline**.
2. Paste your outline. Choose the taxonomy, the parent and how nesting is shown.
3. Click **Preview** and check the tree.
4. Click **Create**. You get a list of the new terms with edit links and an **Undo** button.

= For developers =

* Filter `oakenbit_term_tree_creator_term_args` to change the arguments passed to `wp_insert_term()` for each row (for example to add a description).
* Action `oakenbit_term_tree_creator_term_created` fires after each term is created.
* Filter `oakenbit_term_tree_creator_taxonomies` changes the offered taxonomies.
* Filter `oakenbit_term_tree_creator_max_items` changes the per-run limit (default 500).
* Action `oakenbit_term_tree_creator_run_created` fires once per run with the IDs of all created terms.
* Action `oakenbit_term_tree_creator_form_options` lets you add fields to the options column.

= Privacy =

The plugin does not collect, send or store personal data outside your site. It stores, in your own database, a log of the last 20 runs (date, user ID, taxonomy, IDs of created terms) so runs can be undone, and each user's last used options.

= About this plugin =

oakenbit Term Tree Creator is made by Bernhard Siegl – oakenbit (https://oakenbit.com/). Legal notice: https://oakenbit.com/legal-notice/. Code produced by an AI system operated by Bernhard Siegl, tested automatically and reviewed by hand by Bernhard Siegl.

== Installation ==

1. In your dashboard go to **Plugins > Add New Plugin** and search for "oakenbit Term Tree Creator", or upload the plugin zip file.
2. Activate the plugin.
3. Go to **Posts > Terms from Outline**.

== Frequently Asked Questions ==

= How do I make a category a child of another category? =

Indent it under that category, with spaces or a tab. Every line that is indented further than the line above becomes its child. Lines with the same indentation are siblings.

= My outline uses dashes instead of indentation. =

Choose "Leading dashes" under "Nesting is shown by". Then a line without a dash is top level, "-" is level two, "--" is level three, and so on.

= Can I add terms under a category that already exists? =

Yes. Either choose the existing category as the parent for the whole outline, or write the existing category's name at the top of the outline and indent the new terms under it. The existing category is reused, not duplicated.

= What happens if I run the same outline twice? =

Terms with the same name and parent are reused, so only missing terms are created. If nothing is missing, the preview tells you there is nothing to create. WordPress itself does not allow two terms with the same name under the same parent.

= How do I set the slug? =

Add a vertical bar and the slug after the name: `Getting started | getting-started`. The last vertical bar on a line starts the slug, so a name may contain one if you also give a slug. Without a slug, WordPress creates one from the name.

= Can I undo a run? =

Yes. After a run, and later under "Recent runs", click "Undo" or "Delete terms". Terms have no Trash in WordPress, so the plugin asks first and then deletes only the terms that run created and that are still unused: a term is kept if any post or other content was assigned to it, if it has child terms that were added later, or if you are not allowed to delete it.

= Can it add descriptions? =

Not from the outline. Developers can add a description with the `oakenbit_term_tree_creator_term_args` filter.

= Is there a limit? =

One run creates up to 500 terms. Split longer outlines into parts, or raise the limit with the `oakenbit_term_tree_creator_max_items` filter.

= Some characters disappeared from a name. =

For security, names are cleaned like any text field in WordPress: HTML tags are removed, and a percent sign followed by two letters or digits (such as "%20") is removed.

= Who can use it? =

Users who can manage categories (administrators and editors by default). Taxonomies that need a different capability are listed only for users who have it.

== Screenshots ==

1. Paste an outline, choose the taxonomy and the parent.
2. The preview shows the tree, the slugs and which terms already exist.
3. After creating: a list of the new terms with edit links and an Undo button.
4. The resulting category tree on the Categories screen.

== Changelog ==

= 1.0.0 =
* First release: create nested categories, tags or other taxonomy terms from an indented or dashed outline, with preview, reuse of existing terms, custom slugs and one-click undo.

== Upgrade Notice ==

= 1.0.0 =
First release.
