=== Subset Clone ===
Contributors: functionform
Tags: duplicate, copy, clone, duplicate post, duplicate page
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.8.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Duplicate posts, pages and custom post types with their custom fields, categories, tags and featured image. Every copy starts as a draft.

== Description ==

Subset Clone makes a faithful copy of a post, page or custom post type in one click. The copy has the same content, every custom field, the same categories, tags and custom taxonomy terms, and the same featured image. Every copy starts as a draft, and the original is never changed.

**What gets copied**

* The content, excerpt, parent page, menu order, template, password, and comment and ping settings.
* Every custom field, exactly as it's stored, so Advanced Custom Fields, page builders such as Elementor and Beaver Builder, and SEO settings from Yoast SEO or Rank Math keep working on the copy.
* Categories, tags, custom taxonomy terms and the post format.
* The featured image. Optionally, the copy can also get its own attached media, which shares the original's files, so nothing is duplicated on disk.

The copy gets a new title ("About us (Copy)", or your own format), a fresh date and its own address once it's published. Plugin caches, editing locks and other bookkeeping are left behind, so the copy rebuilds what it needs.

**Where to duplicate**

* **Posts and Pages lists:** a Duplicate link under each item, and a Duplicate bulk action for many at once.
* **Block editor:** Duplicate in the ⋮ menu and in the Summary panel, with an offer to save your changes first.
* **Classic editor:** a Duplicate link in the Publish box.
* **Admin bar:** "Duplicate this" while you're viewing or editing a post.
* **WP-CLI and the REST API**, for scripts and integrations. `wp subset duplicator duplicate` makes copies, and `wp subset duplicator settings list|get|set|reset` reads and changes the settings.

**Safe by default**

* People can duplicate only what they can edit, and only content types they can create. Other people's posts, drafts and custom fields stay protected.
* Choose which content types can be duplicated and which roles can do it, under Subset → Clone.
* A copy shows where it came from ("Duplicated from …") while it's a draft.
* Works on multisite. Each site has its own settings, managed by its administrators.

= For developers =

Every button, the REST route and the WP-CLI command go through one engine and one permission check. Filters control what's copied (fields, custom fields, taxonomies, media), which content types are supported and who may duplicate; actions fire before and after each copy. A plugin with its own duplicator can step aside for its post type. See the developer documentation in the plugin's `docs` folder.

= Source code =

The block editor script, `assets/js/build/editor.js`, is minified. Its readable source ships with the plugin in `assets/js/src/`, and `bin/build-js.mjs` is the esbuild script that bundles it. To rebuild it, install Node.js 22 or later, then run `npm install --no-save esbuild@0.25` and `node bin/build-js.mjs` in the plugin folder. `node bin/build-js.mjs --watch` rebuilds on every change and doesn't minify.

== Installation ==

1. Install and activate Subset Clone from Plugins → Add New.
2. Hover over any post or page in its list and choose **Duplicate**.
3. Optionally, adjust the defaults under Subset → Clone.

== Frequently Asked Questions ==

= I uploaded the new version by hand and now see Subset Clone twice =

Before 0.6.0 the plugin lived in a folder called `subset-duplicator`, so uploading 0.6.0 adds it next to the old copy instead of replacing it. Both copies use the same settings. Deactivate the old copy, then delete it: the Plugins screen marks which one is the old copy. If you update through the Subset Installer you won't see this, because the update replaces the old folder.

= Does it copy Advanced Custom Fields? =

Yes. Every custom field is copied exactly as it's stored, including ACF fields, repeaters and flexible content, and the references that tie them to their field groups.

= Does it duplicate my images? =

The copy uses the same featured image, and the images in its content are the same ones the original uses. No files are duplicated. If you turn on **Attached media**, the copy also gets its own entries in the media library for the original's attached files, sharing the same files on disk.

= Does it work with page builders? =

Yes. Elementor and Beaver Builder layouts are copied exactly, and Elementor's CSS cache is left behind, so Elementor builds fresh CSS for the copy.

= Does it work with WooCommerce products? =

WooCommerce has its own Duplicate action for products, so Subset Clone leaves products to it.

= Does a copy join the original's translations? =

No. With Polylang, a copy keeps the original's language but isn't linked as one of its translations, so you can link it yourself.

= Who can duplicate? =

Anyone who can edit the original and create that type of content, in a role allowed under Subset → Clone. For example, an author can duplicate their own posts but not pages or other people's posts, and an editor can duplicate anything. A copy carries the original's custom fields, so reading a post isn't enough to duplicate it.

= Can a copy be published right away? =

No. Every copy starts as a draft, so nothing goes live by accident.

= Can I duplicate to another site in my network? =

Not in this plugin. Subset Clone Pro adds copying between the sites of a multisite network.

== Screenshots ==

1. A Duplicate link under every post or page you're allowed to copy.
2. The copy is a new draft, and the list says where it came from.
3. Duplicate from the block editor's Options menu, or from the Summary panel.
4. A copy shows which post it was duplicated from while it's a draft.
5. Subset → Clone: content types, the copy's title and author, attached media, and who can duplicate.

== Changelog ==

= 0.8.1 =
* Security: The Subset menu and its Overview page now need the same capability as a Subset page you can open, so a subscriber no longer reaches the Overview.
* Changed: Built on subset-core 1.13.3.

= 0.8.0 =
* Changed: New defaults. Posts, pages, patterns and the theme's post types show the Duplicate actions, and other plugins' post types don't until you switch them on. Copies keep the original's author and get copies of its attached media. Administrators and editors can duplicate; authors, contributors and subscribers can't until you allow them. Settings you've already saved are kept, but post types from other plugins switch off.
* Added: The `enabled_post_types` setting and the `subset_dup_post_type_on_by_default` filter.

= 0.7.1 =
* Changed: Errors when a duplicate can't be made from the editor are worded as in the other Subset plugins.
* Changed: Built on subset-core 1.13.0.

= 0.7.0 =
* Changed: Add-ons now hook `subset_dup_admin_tab_{slug}`; the old `subset_dup_admin_panel_{slug}` hook still works but is deprecated. With `WP_DEBUG` on, using it logs a deprecation notice.
* Changed: The `subset_dup_admin_enqueue` action now also passes the slug of the open tab.
* Under the hood: shares more code with the other Subset plugins.
* Changed: Built on subset-core 1.11.1.

= 0.6.1 =
* Fixed: A copy of 0.6.0 running from the old folder, as on some development sites, no longer stops with an error on load.

= 0.6.0 =
* Changed: The plugin now lives in a `subset-clone` folder, with the text domain `subset-clone`. If you update through the Subset Installer, nothing changes for you: the update moves it and keeps it active. Settings, links and integrations keep working.
* New: If you upload this version by hand, it lands next to the old `subset-duplicator` copy. It waits until you deactivate the old copy, then takes over with the same settings, and the Plugins screen and Site Health tell you to delete the old copy.
* Changed: Built on subset-core 1.10.0.

= 0.5.2 =
* Fixed: `wp help` for the `settings` command is written for users, and its examples use this plugin's own command.
* Changed: Built on subset-core 1.9.1.

= 0.5.1 =
* Fixed: WordPress no longer logs a "translation loading was triggered too early" notice for this plugin on admin pages.
* Changed: Built on subset-core 1.9.0.

= 0.5.0 =
* Changed: Duplicating a post now requires permission to edit the original, because the copy includes all of its hidden data. Authors and contributors can no longer copy other people's published posts. Authors can still copy their own posts, and contributors their own drafts.
* Changed: Built on subset-core 1.8.1.

= 0.4.3 =
* Changed: The plugin is now called Subset Clone. Settings and data are unchanged.

= 0.4.2 =
* Tweak: the About tab uses plain WordPress admin styling.

= 0.4.1 =
* Fix: accessibility and layout polish. Bulk Duplicate is capped at 50 posts per request, the classic editor Duplicate link says it copies the last saved version, and the role checkboxes and admin bar link have clearer labels.

= 0.4.0 =
* New: Duplicator now lives under a shared Subset menu (Subset > Duplicator). Old Settings > Duplicator links redirect.

= 0.3.0 =
* New: the Settings > Duplicator screen now has hooks so add-ons can add their own tabs.

= 0.2.1 =
* The plugin now includes the readable source of its block editor script, with build instructions.
* Hardened output escaping on the settings page.

= 0.2.0 =
* New: an About tab with a short introduction to Subset and a link to subsetwp.com.

= 0.1.0 =
* First release.
