How to easily duplicate a WordPress page (or post)?

Duplicating a page or post in WordPress is a feature that comes in handy when updating or redesigning the website.

When you duplicate a WordPress page, you’ll retain all the data, including meta description, SEO settings, images, etc. This feature saves you a lot of time.

There are several ways to clone a WordPress page or post. Moreover, it’s a simple process that you can do with or without the help of a plugin.

Are you interested? Let’s get started!

Table of content:

Duplicate a WordPress page or post (with plugin)

If you want a simple solution to clone your page, you should use a plugin. In fact, by using plugins, you can clone your page just with a single click.  

Here’s the list of the best WordPress plugins to duplicate your page and posts. 

Note: All the following plugins perform the same function (i.e., duplicate a page or post). Moreover, they are easy to use. So, you won’t go wrong by choosing either of them. 

1. Yoast Duplicate Post

Yoast Duplicate Post

Yoast Duplicate Post is the most popular plugin to duplicate pages or posts. The plugin has more than 3 million active installations. 

This plugin duplicates the content, comments, pictures, URL slug, etc., of a page or post. In fact, this is the plugin that I use to clone my website’s pages. 

This plugin has a feature that lets you add prefix or suffix to the title, allowing you to differentiate between the original and the duplicate page.

Now let’s see how to use the Yoast Duplicate Post plugin. 

  1. Install and activate the plugin from the WordPress plugin directory
  2. Go to the WordPress dashboard. Click on Pages → All pages (to clone a page); Posts → All posts (to clone a post). 
  3.  Click on “Clone” to duplicate the page. Click on “New Draft” to clone the page and open it in the post editor. 
Yoast Duplicate Post

2. Duplicate Page

Duplicate Page

Duplicate Page is a popular and easy-to-use plugin that helps you with cloning a page or post. 

If you want to achieve desired results, make sure to modify the settings of the plugin to suit your needs. 

Here’s how you should use the Duplicate Page plugin. 

  1. Install and activate the plugin. 
  2. Hover over the page or post that you want to duplicate.
  3. Click on the “Duplicate This” option to clone the page. 
Duplicate Page

3. Duplicate Page and Post

Duplicate Page and Post

Duplicate Page and Post is a lightweight plugin that lets you quickly clone your page or post. Moreover, this plugin enables you to clone custom posts too. 

Similar to other plugins in this list, using Duplicate Page and Post plugin is pretty simple. The following is the method to use the plugin. 

  1. Install and activate the plugin.
  2. Hover over the page or post that you want to duplicate.
  3. Click on the “Duplicate” option to clone the page.
Duplicate Page and Post

There are many more plugins that perform the same function. However, if I list all of them, you’ll be bored. Also, as mentioned above, you won’t go wrong by choosing either of the plugins.

Duplicate a WordPress page or post (without plugin)

If you want to reduce the plugins on your website, you should look at the manual way of duplicating a WordPress page or post.

1. Enable the post duplication option through function.php code

Note: Before making any changes to the website core files, make sure to take the complete backup of your website. 

The word ‘coding‘ can make many people feel overwhelmed. However, coding is not always complicated as in our case now. 

Ok! 

If you want to enable the post duplication option, you should first access the function.php file to add a code snippet. You can access it either through FTP, inbuilt WordPress file editor, or File Manager. 

Now, add the following code snippet to the end of the function.php file. 

				
					/*
 * Function for post duplication. Dups appear as drafts. User is redirected to the edit screen
 */
function rd_duplicate_post_as_draft(){
  global $wpdb;
  if (! ( isset( $_GET['post']) || isset( $_POST['post'])  || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
    wp_die('No post to duplicate has been supplied!');
  }
 
  /*
   * Nonce verification
   */
  if ( !isset( $_GET['duplicate_nonce'] ) || !wp_verify_nonce( $_GET['duplicate_nonce'], basename( __FILE__ ) ) )
    return;
 
  /*
   * get the original post id
   */
  $post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_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',
      '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;
        if( $meta_key == '_wp_old_slug' ) continue;
        $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);
      $wpdb->query($sql_query);
    }
 
 
    /*
     * finally, redirect to the edit post screen for the new draft
     */
    wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
    exit;
  } else {
    wp_die('Post creation failed, could not find original post: ' . $post_id);
  }
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
 
/*
 * Add the duplicate link to action list for post_row_actions
 */
function rd_duplicate_post_link( $actions, $post ) {
  if (current_user_can('edit_posts')) {
    $actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=rd_duplicate_post_as_draft&post=' . $post->ID, basename(__FILE__), 'duplicate_nonce' ) . '" title="Duplicate this item" rel="permalink">Duplicate</a>';
  }
  return $actions;
}
 
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );
				
			

This code snippet enables post duplication. If you want to enable page duplication, use the same code snippet but replace the last with the following code.

				
					add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);

				
			

Once done, click on “Update File”.

Now you’ll be able to see a “Duplicate” option on all pages and posts.

How to duplicate multiple WordPress pages?

If you want to duplicate multiple WordPress pages or posts, plugins are the quickest and effective solution over manual methods. 

Consider that I’ve installed the Yoast Duplicate Post plugin or any other duplicating plugin for that matter. Now, it’s pretty simple for me to duplicate multiple pages or posts. 

First, I have to select the pages that I want to clone. Next, from Bulk actions, select “Clone”. Next, click on “Apply”. 

Duplicating multiple pages

That’s it! Isn’t this a simple process? 

Conclusion

I hope this blog gave you a clear idea about duplicating a WordPress page.

If you want to clone your page or post, using plugins is the easiest option. The page duplicating plugins won’t cause any noticeable slowdown to your website as they are small in size.

However, if you have only a single page to clone, you can use the “Copy All Content” feature in the WordPress editing screen.

If you have any questions related to cloning a WordPress page or post, please let me know in the comment section below.

Picture of Abdul Wadood

Abdul Wadood

Abdul Wadood is the founder of Righty Guide, a digital marketing startup company. He has immense knowledge of digital marketing and is also a good mentor with excellent leadership skills.

Leave a Comment

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

Free Affiliate Marketing E-Book

Sign up for our newsletter and get your free affiliate marketing e-book!