=== Post DuplicateX - Advanced Post Duplicator ===
Contributors: vishwasr
Donate link: https://www.paypal.com/paypalme/vishwasr92
Tags: duplicate post, clone post, copy post, duplicate page, duplicate custom post type
Requires at least: 5.8
Tested up to: 7.1
Stable tag: 1.1.0
Requires PHP: 7.4
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Effortlessly duplicate posts, pages and custom post types with a single click. Save as draft, private, public, or pending with complete control.

== Description ==

**Post DuplicateX** is the ultimate WordPress solution for efficiently duplicating any content type on your website. With a sleek, intuitive interface and powerful customization options, you can duplicate posts, pages, and custom post types with just one click.

### 🚀 Save Time & Boost Productivity

Create exact duplicates of your content instantly — perfect for creating templates, making variations of existing content, or testing changes without affecting live pages.

### ✨ Key Features

* **Universal Content Duplication**: Clone posts, pages, and any custom post type with a single click.
* **Bulk Duplication**: Duplicate multiple posts, pages, or custom post types simultaneously from the WordPress Bulk Actions dropdown.
* **Multiple Duplication Points**: Duplicate from post list rows, admin toolbar, classic editor, or block editor (Gutenberg).
* **Flexible Publication Status**: Save duplicates as draft, published, private, or pending review.
* **Author & Date Control**: Retain original author and publication dates, or assign duplicates to the current user and current time.
* **Role-Based Permissions**: Control precisely which user roles have permission to duplicate content.
* **Customizable Titles**: Add dynamic prefixes (e.g. "Copy of") and/or suffixes to duplicated content for instant identification.
* **Smart Redirection & Notifications**: Choose where users land after duplication with dismissible success notices and direct edit links.
* **Complete Metadata & Template Cloning**: Copies all custom fields, page templates, taxonomies, categories, tags, and featured images.
* **Developer Friendly**: Extensible action hooks and filters for custom duplication logic.
* **Lightweight & High Performance**: Clean vanilla JS, zero external dependencies, and zero database bloat.

### 🛠️ Ultimate Control & Settings

Post DuplicateX offers comprehensive settings that allow you to:

1. **Control Access**: Define exactly which user roles can duplicate content.
2. **Select Post Types**: Choose which content types can be duplicated.
3. **Customize Link Placement**: Select where duplicate buttons appear (list table rows, bulk actions, admin bar, classic editor, block editor).
4. **Define Post Status**: Set the default publication status for duplicates (Draft, Published, Private, Pending Review).
5. **Title Customization**: Add descriptive prefixes/suffixes to distinguish duplicated content.
6. **Author & Date Settings**: Choose whether duplicated content inherits original author/date or uses current user/time.
7. **Bulk Duplication Support**: Enable or disable bulk duplication actions per post type.
8. **Navigation Control**: Determine where users land after duplication (Post List, Edit Screen, or New Post).

### 💻 Developer Filters & Extensibility

Post DuplicateX includes clean hooks for developers to customize or extend the duplication workflow:

* `postdx_duplicate_post_args`: Filter the post data array before inserting the duplicated post.
* `postdx_excluded_meta_keys`: Filter the array of meta keys excluded from duplication.
* `postdx_after_post_duplicate`: Action triggered immediately after a post is cloned (`$new_post_id`, `$post`, `$post_id`).

### 🔍 Perfect For

* Content creators who publish similar structured posts regularly
* Website developers creating templates for clients
* Site owners who want to A/B test content variations
* Anyone who wants to save time when creating similar content

### 🌟 Professional Workflow Integration

Post DuplicateX seamlessly integrates into your existing WordPress workflow, with duplicate options available wherever you work with content.

== Installation ==

1. Upload the `post-duplicatex` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to the Post DuplicateX settings page to configure your preferences
4. Start duplicating content with a single click!

== Frequently Asked Questions ==

= Can I duplicate custom post types? =

Yes! Post DuplicateX supports all public custom post types (such as WooCommerce products, portfolios, events, etc.). Simply enable them in the plugin settings.

= Can I duplicate multiple posts at once? =

Yes! You can select multiple posts in your list view, select "Duplicate" from the Bulk Actions dropdown, and click Apply to duplicate them all at once.

= What happens to meta fields and taxonomies when duplicating? =

Post DuplicateX intelligently copies all meta data, custom fields, page templates, categories, tags, and taxonomies to the duplicated content.

= Can I control who has permission to duplicate content? =

Absolutely. The plugin allows you to specify exactly which user roles have duplication privileges (Administrator, Editor, Author, Contributor, or custom roles).

= Where will the duplicate links/buttons appear? =

You can choose any combination of these locations:
* In post/page listings as a row action
* In the Bulk Actions dropdown
* In the admin toolbar when viewing/editing content
* In the publish box of the classic editor
* In the sidebar panel of the block editor (Gutenberg)

= Will the duplicated post have the same published date and author? =

You can choose! In the settings, you can configure whether duplicated content should have the current date/time or retain the original publication date, and whether it should be assigned to the current user or original author.

= Does it work with page builders like Elementor, Divi, etc? =

Yes! Post DuplicateX works with all major page builders by copying all post meta data and custom template attributes.

= Can I add custom text to duplicated post titles? =

Yes. You can add prefixes (e.g., "Copy of ") and/or suffixes to duplicated post titles for easy identification.

= Can developers customize what metadata is cloned? =

Yes, developers can use the `postdx_excluded_meta_keys` filter to add or remove meta keys from being cloned, or `postdx_duplicate_post_args` to customize the post data prior to insertion.

== Screenshots ==

1. Main settings page with all customization options
2. Duplicate link in page/post list view
3. Duplicate button in the classic editor
4. Duplicate option in the block editor (Gutenberg)
5. Duplicate button in the admin toolbar

== Changelog ==

= 1.1.0 =
* Tested and verified compatibility with WordPress 7.1.
* Added Bulk Duplication action in post/page list tables.
* Added Post Author option (choose between Current User or Original Author).
* Added Post Date option (choose between Current Date or Original Date).
* Added dismissible admin confirmation notices after duplication.
* Preserved custom page templates (`_wp_page_template`) when cloning pages.
* Fixed admin bar duplicate link display conditions.
* Standardized direct file access guards and code architecture for WordPress Plugin Check (PCP) compliance.
* Replaced redirects with `wp_safe_redirect` for improved security.
* Added developer hooks and filters (`postdx_duplicate_post_args`, `postdx_excluded_meta_keys`, `postdx_after_post_duplicate`).

= 1.0.0 =
* Initial release with complete duplication functionality
* Support for all post types
* Multiple duplication locations
* Flexible status options
* Role-based permissions
* Custom prefixes and suffixes
* Advanced settings page

== Upgrade Notice ==

= 1.1.0 =
Version 1.1.0 brings WordPress 7.1 compatibility, bulk duplication, duplication admin notices, post author/date options, and security improvements.