How to Duplicate Pages and Posts in WordPress

How to Duplicate Pages and Posts in WordPress

There are many reasons why you might have to use plugins to duplicate pages and posts in WordPress.

For instance, when redesigning your website, you want to maintain consistency in your design layout. An easy way to achieve that is by duplicating your pages rather than building them up from scratch.

Another typical example is if you run an eCommerce site. To save time and minimize layout problems, it’s best you duplicate your product pages.

Thankfully, you can easily clone posts and pages in WordPress. And you can do so without compromising the safety and integrity of your website.

In this article, we will show you how to use plugins for duplicating posts and pages in WordPress. If you prefer to do so manually, we’ve also got you covered.

Content:

Reasons to Clone or Duplicate Posts and Pages in WordPress

We briefly listed out reasons why you might want to clone your pages and posts in WordPress. Now, we will elaborate more on them.

Reason 1: Editing a Page on a Live Site

You might find yourself needing to make edits to a page on your live WordPress website. At such times, you have two options:

  • Editing the live page directly: This method is pretty risky – you might end up breaking your site. Even if you don’t break your site, the live changes could confuse your audience.
  • Duplicating the page, making all needed edits to the duplicate, and then replacing the original page with the duplicate. If you go this route, the chances of breaking things is greatly minimized.

To duplicate a post or page in WordPress, you can either use a plugin or do so manually. There are quite a number of duplicate post plugins you can use for this task. We will be looking at a few shortly.

Reason 2: Creating multiple, similar products in WooCommerce

If you run an e-commerce store, you might find yourself creating several product pages with a similar design and layout. This can become extremely tedious, especially if you have a large product collection.

To save time and energy and improve efficiency, simply create a page that will serve as a template. Then duplicate it as many times as the number of products you have.

Reason 3: Maintaining Design Structure across Pages

Let’s say your website has become old and outdated, and you find yourself needing to redesign it. During the redesign process, you will want your pages and posts to maintain the same design across.

To achieve this, you have the option of manually copying and pasting the contents into your new site. But this would be tedious. Worse, when you copy the content of a post, the media files and SEO data will be left out.

The best way to go about this is by creating an original version, and then duplicating it as many times as you wish. And in turn, making tweaks across the duplicates.

Reason 4: Alternative Staging Site

A staging site is like a test version of your live site. So instead of going through the whole process of creating one, you can create a duplicate post or page to experiment with your content.

Reason 5: A/B Testing

In the case of split testing, you do not have to create another page/post from scratch. Simply clone the original make and make the changes needed.

Reason 6: Multilingual Content

If you have a site that offers multiple languages, duplicating your posts eases the process of translation. All you need to do is clone the post design and contents, then convert the texts to different languages.

How to Duplicate Pages and Posts in WordPress with a Plugin

Using a plugin is the easiest way to duplicate a WordPress post. For this demo, we will be using the Duplicate Post plugin. Of course, there are many more you could use, and we will be discussing them later on.

Step One

So, the first thing you have to do is to install and activate the plugin. We explained in detail how to do that in this article. After you must have installed the plugin, proceed to step two.

Step Two

With the plugin installed and activated, you can now proceed to duplicate a page or post on your WordPress website.

To duplicate a page, navigate to Pages >> All Pages.

All pages section

Hover over the page you would like to duplicate. Beneath it, you will see a series of links. Among these links are Clone and New Draft.

Clone and New Draft links

If you wish to just duplicate the page without needing to edit it, click Clone. Bear in mind that if the original post is live – that is, has been published – the duplicate will also go live.

On the other hand, clicking New Draft will duplicate the page, and then open it in editor mode. That is to say, you will get to first edit the duplicated page before publishing it.

So basically, that’s how you duplicate pages in WordPress with this plugin. To duplicate a post, follow the same steps, but this time navigate to Posts >> All Posts.

Customizing the Duplicate Post Plugin

There are still tons of things you can do with this plugin when properly customized.

To customize the plugin, you first need to open its settings by navigating to Settings >> Duplicate Post.

Customize the WordPress duplicate page plugin

Upon click, you will see three tabs, namely What to Copy, Permissions and Display.

The What to Copy section is where you get to choose what to copy from the original post to the duplicate post.

What to copy section

If you would like the date, status, slug etc. of the original post to be copied to the duplicate, simply tick their checkboxes.

You can also uncheck items you don’t want to copy over.

In the Permissions section is where you get to permit user roles. That is, where you select which user has the permission to duplicate a post.

Permissions section

By default, only the Administrator and Editor have the power to duplicate posts or pages. But you can extend this responsibility to the Author and Contributor.

Also, if your WordPress site supports custom post types, in the Permission section, you can enable this feature on your duplicated post. Just ensure that Posts and Pages are checked.

Finally, in the Display section, you can select where you want the clone and new draft links to appear.

Display section

By default, they show only in the Post list, but you can make them show in other places like Admin bar, Edit screen, etc.

When you are done customizing, scroll down and click Save Changes.

How to Duplicate Posts Manually

WordPress Gutenberg has the option of duplicating a post just at the click of a button.

However, due to its limitation, it’s recommended you use a plugin rather than manual duplication.

But if you would still like to proceed manually, here’s how to:

Step 1

Log into your WordPress dashboard, navigate to Posts >> All Posts.

Step 2

In the post list, select the post you would like to duplicate and open it. With the post opened, click on the three-dot icon at the top right corner.

Click on three dotted line

Upon click, locate the Copy All Content option, and click on it.

Locate the Copy All Content option to duplicate post

Doing this will copy all content of the post, including images and other media inserted into it.

Step 3

Create a new post by navigating to Posts >> New Posts. Then paste the content you had copied earlier. With that, you have a brand new duplicated post.

Copy and Paste Code Manually

This is a pretty simple method to duplicate your WordPress posts. All it requires is that you copy and paste the code of the post you want to edit manually.

To begin, click the edit link on the post or page you want to clone. Next, switch to its “Text” editor.

Switch to text editor

Copy the entire code shown for the page.

Copy entire code

Next, open a new page, switch to its “Text” editor and paste the code you just copied there. Once that is done, switch back to the “Visual” editor to see the cloned content. You can now twerk the changes as you wish.

The downside to this method is that it has to be done individually for each post or page. This can take quite some time. Hence, we recommend the use of WordPress duplicate plugins to save time.

Manually Adding Code

Another way you can manually duplicate a post or page is to activate a duplication link in the post/pages sections. This can be done by editing the code in your function.php file. You can edit this file from an FTP client like FileZilla, your web host’s file manager or your WordPress editor.

For this tutorial, we will be using the built-in WordPress editor. Remember to make a backup of your website first.

To begin, head on to your Appearance >> Theme File Editor.

Theme file editor

Next, paste this line of code at the end of the 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 can also be used to duplicate a page. You will only need to replace the last line of code with this:

 

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

Afterwards, click on the Update File button to register your changes.

Update file

Next, head back to your WordPress Dashboard. A duplication link should now appear when you hover over a page or post you want to clone.

Other Plugins for Duplicating Posts and Pages

The Duplicate Post plugin isn’t the only plugin that can get the job done, there are a slew of others. Let’s look at a few.

Duplicate Page

Duplicate Page - WordPress Duplicate page plugin

The Duplicate Page plugin is a simple and lightweight tool that simplifies the process of duplicating pages and posts in WordPress. With a single click, you can easily clone your posts or pages. This makes the process quick and efficient.

With this plugin, you get the option to duplicate your posts/pages as draft, private, public and pending. It also allows you to duplicate various types of contents, including custom post types, making it a versatile plugin.

The Duplicate Page plugin comes with a user friendly interface, making it easy for users of all skill levels. Further, being lightweight, the plugin has minimal impact on site performance. It also ensures a smooth user experience.

Overall, the plugin works to save time and effort while providing users with the needed functionality to manage their contents.

Post Duplicator

Post Duplicator - WordPress duplicate page plugin

Post Duplicator plugin is another tool that can be used to duplicate WordPress posts, pages and custom post types. The plugin is flexible as it supports various content types. This includes custom taxonomies and custom fields.

The Post Duplicator plugin handles bulk duplication. So you can duplicate multiple posts or pages at once. This makes it easy and efficient for users that handle large volumes of content. Further, you get to choose the elements of the content you wish to duplicate.

The plugin comes with a friendly user interface, ensuring a seamless integration with the WordPress dashboard.

Yoast Duplicate Post

Yoast Duplicate Post - WordPress Duplicate page plugin

Yoast Duplicate Post is a simple and straightforward plugin. With a single click, you can duplicate posts, pages and custom post types.

The plugin supports bulk duplication. So users can duplicate multiple posts, pages and custom post types simultaneously. The plugin is also flexible as it allows you to duplicate contents as drafts, private posts or published posts.

In addition, Yoast Duplicate Post comes with customizable settings. So users can customize their post status, title format, taxonomies and more. Further, the plugin provides a prefix and suffix option. This is to enable you to differentiate the original post from the clone.

The Yoast Duplicate Post plugin provides a selective duplication feature. This gives users the chance to choose which elements of their content to duplicate, thus, giving users control over the duplication process. The plugin is a useful tool for bloggers, content creators, and site administrators who need to quickly replicate existing content.

SEO Points to Remember when Handling Duplicate Contents

Duplicate contents, when done wrongly, can negatively affect your site’s seo. To prevent this, here are some seo points you should keep in mind when duplicating contents:

Implement Canonical Tags

Canonical tags are HTML code snippets that tell search engines the version of a url that is original and you want indexed. Doing this helps to avoid duplicate content issues and secures your ranking signals.

Use 301 Redirects

This is important as 301 redirects help to guide users and search engines to the from the duplicate URLs to the correct URL.

Update Content

It is vital to update duplicated contents to ensure your users are provided with unique and valuable contents.

Monitor Regularly

Make sure you regularly monitor for duplicate content and seo issues. This helps you to detect any issues early on and maintain your site’s seo health. One of the tools you can use to monitor your site’s seo health is the Google search console.

 

By applying these strategies, you will be able to manage possible SEO issues effectively. Further, you will be able to maintain your site’s visibility and ranking in search engines.

Conclusion

Duplicating posts and pages is a great way to save time when working on a WordPress web design project.

If you manage several websites for a client, for instance, you will better appreciate what duplicator plugins can do.

We have shown you three different duplicator plugins that work pretty well.

Do bear in mind that these plugins may not work if the pages you want to duplicate were created with page builders like Divi, Elementor, etc. Some page builders give you the option of duplicated designed pages. It’s best you use them rather than duplicator plugins.

WordPress Gutenberg gives you the option of duplicating your pages manually, and we showed you how to go about it in this article.

If you found this article useful, do share.

More Resources:

 This post was written by Sam Mulaim

Hello! I’m Sam - the founder and CEO of FixRunner WordPress support. When I started FixRunner one of my goals was to help people run a successful website and overcome WordPress issues. I don’t have much time these days to write new posts but when I do I enjoy it very much.

Last edited by: FixRunner Team