How to Duplicate a Page in WordPress: A Comprehensive Guide

Duplicate a Page in WordPress

In the dynamic world of WordPress, efficiency and convenience are key. As a website owner or content creator, you’ve likely encountered the need to replicate a page or post. Whether it’s for testing new layouts, maintaining consistent formatting, or repurposing content, the ability to duplicate a page can save you significant time and effort. In this guide, we’ll explore multiple methods to duplicate a page in WordPress, using both plugins and manual techniques.

Why Clone or Duplicate a Page/Post in WordPress?

Duplicating a page or post might not always be on your to-do list, but it’s a trick that can come in handy for various reasons:

Testing New Designs: Before implementing a new design, duplicate a page to test how the changes will look without affecting your live site.

Consistency: Maintaining a consistent layout and formatting across similar pages is easier when you duplicate an existing page.

Time-Saving: Instead of recreating the same content layout, you can save time by duplicating and then making minor adjustments.

Content Repurposing: Repurpose an existing page by duplicating it and then modifying the content for a new purpose.

Backup: Duplicate important pages as a backup measure before making major changes.

Now, let’s explore various methods to duplicate pages in WordPress.

Method 1: Using Plugins

1. Post Duplicator

The Post Duplicator plugin simplifies the process of duplicating posts and pages. Here’s how:

  • Install and activate the Post Duplicator plugin.
  • In the WordPress dashboard, navigate to “Posts” or “Pages,” depending on what you want to duplicate.
  • Hover over the post/page you want to duplicate and click “Clone.”
  • A duplicated version of the post/page will appear in the list with “Clone of” added to the title.

2. Duplicate Page and Post

The Duplicate Page and Post plugin is another popular choice for duplicating content:

  • Install and activate the Duplicate Page and Post plugin.
  • Head to the list of posts/pages in the WordPress dashboard.
  • Hover over the post/page you want to duplicate and click “Clone.”
  • The duplicated post/page will be listed alongside the original.

3. Duplicate Post Plugin

The Duplicate Post plugin is a versatile option for replicating content:

  • Install and activate the Duplicate Post plugin.
  • In the WordPress dashboard, go to “Settings” > “Duplicate Post.”
  • Configure the plugin settings according to your preferences.
  • Navigate to “Posts” or “Pages,” hover over the content you want to duplicate, and click “Clone.”
  • The duplicated content will be saved with the same title and marked as “Copy.”

Method 2: Duplicating Without Plugins

While plugins offer convenience, duplicating pages without plugins is also possible.

1. How to Duplicate a Post via the Functions.php File

Please note that modifying your theme’s functions.php file requires some technical knowledge. Here’s how to duplicate a post:

  • Access your WordPress files using an FTP client or through your hosting control panel.
  • Locate the functions.php file of your theme (usually found in wp-content/themes/your-theme-name).
  • Add the following code snippet to the functions.php file:

function duplicate_post_as_draft(){
global $wpdb;
if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'duplicate_post_save_as_new_post' == $_REQUEST['action'] ) ) ) {
wp_die('No post to duplicate has been supplied!');

* get the original post id

$post_id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);

* and all the original post data then

$post = get_post( $post_id );

* if you don’t want current user to be the new post author,
* then change next couple of lines to this: $new_post_author = $post->post_author;

$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;

* if post data exists, create the post duplicate

if (isset( $post ) && $post != null) {

* new post data array

$args = array(
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_author' => $new_post_author,
'post_content' => $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_name' => $post->post_name,
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
'post_status' => 'draft', // You can change this to publish if needed
'post_title' => $post->post_title,
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order

* insert the post by wp_insert_post() function

$new_post_id = wp_insert_post( $args );

* get all current post terms ad set them to the new post draft

$taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");
foreach ($taxonomies as $taxonomy) {
$post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);

* duplicate all post meta just in two SQL queries

$post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
if (count($post_meta_infos)!=0) {
$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
foreach ($post_meta_infos as $meta_info) {
$meta_key = $meta_info->meta_key;
$meta_value = addslashes($meta_info->meta_value);
$sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";
$sql_query.= implode(" UNION ALL ", $sql_query_sel);

* finally, redirect to the edit post screen for the new draft

wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
} else {
wp_die('Post creation failed, could not find original post: ' . $post_id);
add_action( 'admin_action_duplicate_post_save_as_new_post', 'duplicate_post_as_draft' );

* Add the duplicate link to action list for post_row_actions

function add_duplicate_link( $actions, $post ) {
if (current_user_can('edit_posts')) {
$actions['duplicate'] = 'Duplicate';
return $actions;
add_filter( 'post_row_actions', 'add_duplicate_link', 10, 2 );

  • Save the functions.php file.
  • Go to the list of posts in your WordPress dashboard.
  • Hover over the post you want to duplicate and click “Duplicate.”

2. How to Duplicate a Page in WordPress via the functions.php File

To duplicate a page, follow the same steps as above, but replace the “post” references in the code with “page.”

In Conclusion

Whether you opt for plugins or prefer manual methods, duplicating a page or post in WordPress is a valuable skill that can save you time and effort. The ability to replicate content while maintaining formatting and functionality is a boon for website owners and content creators alike. Choose the method that suits your comfort level and needs, and you’ll have the power to efficiently manage your website’s content and design. Remember, WordPress’s versatility empowers you to navigate through challenges and enhance your website’s performance with ease. Please feel free to reach out to us if you encounter any issues or require assistance.We are here to help!

Leave a Reply

Your email address will not be published. Required fields are marked *