NOUSK

Nousk Post Duplicator: Duplicating WordPress content with control

Nousk Post Duplicator is a WordPress plugin that allows for the creation of complete copies of existing content while preserving structure and data.

Notice: This plugin interface and documentation are currently available only in Portuguese. English translation is planned for a future update.

The goal of this plugin is to simplify content duplication within WordPress, maintaining the essential structure and data.

The plugin adds a Duplicatelink to the WordPress post listing. When triggered, the plugin creates a new entry based on the original content, preserving key data and setting the copy as a draft. The user remains on the listing page after duplication, allowing for the quick creation of multiple copies.

What is duplicated

The plugin replicates the essential elements of the content:

  • Title (with unique name generation)
  • Content
  • Excerpt
  • Featured Image
  • Taxonomies (such as categories and tags)
  • Post Meta (custom fields)
  • Page Attributes (such as parent page and menu order)

This ensures that the original content’s structure is fully preserved in the copy.

How it works internally

Duplication is performed using the ID of the original content. The plugin follows these steps:

1. Retrieves post data using `get_post()`.
2. Creates a new post using `wp_insert_post()`.
3. Replicates taxonomies with `wp_set_object_terms()`.
4. Copies metadata using `get_post_meta()` and `add_post_meta()`.

The title of the copy is automatically adjusted to avoid conflicts, and the status of the new content is always set to `draft`.

How this helps

This plugin streamlines common workflows in daily development and content editing. It is particularly useful when you need to:

  • Create variations of the same content.
  • Reuse existing structures.
  • Work with similar pages.
  • Set up base layouts for new content.

This reduces repetitive tasks and avoids the need for manual content recreation.

Unique Title Generation

When duplicating content, the plugin ensures the new title does not conflict with existing ones through an incremental check. If an identical title already exists, the plugin automatically adjusts it, creating incremental variations until an available name is found.

Intentional Behaviors

Specific decisions were made to maintain consistency and avoid side effects:

  • Draft Status:Copies are always created as drafts.
  • Stay on Page:The user remains on the listing screen after duplicating.
  • Filtered Metadata:Internal metadata such as `_edit_lock` and `_edit_last` are notcopied. These are ignored to prevent editing conflicts and unexpected behavior in the dashboard.

Technical Considerations

Duplication is more than just a visual copy; it involves reconstructing the content within WordPress while respecting its internal structure. This includes:

  • Separation between content, taxonomies, and metadata.
  • Using native WordPress functions to maintain compatibility.
  • Permission validation before execution.

The action is executed via `admin-post.php`, protected by nonces and capability checks.

Conclusion

Nousk Post Duplicator is a simple yet powerful tool for anyone working with content creation and management in WordPress. It adds a functionality that optimizes common processes, reducing manual effort while maintaining full control over duplicated content.

Github

⇐Back to Blog
Github LinkedIn YouTube Instagram TikTok