How to Duplicate a Page in WordPress [3 Easy Methods]

How-to
0 comments
pThis post may contain affiliate links, read our disclosure for more info.

Written by Shakeel Anjum
Last updated on Jun 19, 2021

Do you want to duplicate a page in WordPress without the risk of losing the original version? Then, this tutorial is for you.

In this post, we’ll show you how to create an exact copy of any page or post on your site in just a few clicks to speed up your content creation process.

You must probably have hired virtual assistants; they are more prone to human error when copying the same template, generally the important sections, right?

Related: How to Become a WordPress Developer in 2021

After reading the post, you’ll be able to effortlessly post bulk-clone posts, pages, and other custom fields content.

Let’s get started!

Duplicate a Page in WordPress With Plugins

We’ll reveal some duplication plugins that can be used to duplicate pages and other content types. Here are a few plugins you may find useful:

1. Yoast Duplicate Post

Yoast Duplicate Post Plugin To Duplicate A Page In Wordpress

Yoast Duplicate Post plugin is the best plugin that has a duplicate option. It can clone pages and posts and has a feature of bulk functionality. This plugin allows users of any level of experience in WordPress to create duplicate posts with ease.

How to use it? First of all, go to Plugins > Add New > Type “Yoast Duplicate Post.” Now install the plugin and activate it.

Yoast Duplicate Post Install Process
Installing Yoast Duplicate Post Plugin

Once activated, visit the Posts or Pages section to clone any page or post — all the SEO elements will be copied too.

Clone A Page
Clone A Single Page

The best feature? You can use the bulk functionality feature to duplicate blog posts, pages, and custom fields if you have a bunch of posts and other such content.

Image15
Bulk Cloning Of Pages Or Posts Feature

2. Duplicate Page

Duplicate Page Plugin
Duplicate Page Plugin

The Duplicate Page plugin helps to clone posts and pages with a single click, meaning no more copying posts and pasting content or wasting time writing unique content from scratch. This plugin makes this process quick, simple, and painless.

How to use it? Go to Plugins > Add New > Duplicate Page.

Duplicate Page Installation Process
Installing Duplicate Page From Wordpress Plugin Section

Open Posts or Pages in WordPress to duplicate it.

Duplicate This
Duplicate This Feature

3. Duplicate Page or Post

Duplicate Page Or Post
Duplicate Page Or Post

Duplicate Page or Post plugin will automatically copy all of the text from one page or post onto as many others as needed at once with all the post settings.

It’s perfect for creating multiple landing pages or duplicating entire sections without having to do anything more than drag & drop.

How to use it? Go to Plugins > Add New > Duplicate Page or Post.

Duplicate Page Or Post Install Process
Install Duplicate Page Or Post On Wordpress

Once installed and activated, you can clone a page easily.

Duplicate This Plugin
Duplicate Feature When You Install The Plugin

4. Post Duplicator

Post Duplicator Plugin
Post Duplicator Plugin

Copying posts and pages can be a time-wasting operation if you do it manually. Post Duplicator allows you to copy entire posts and pages with all duplicate post features.

It is tough to do it in the WP editor because of the manual work you need to do. However, it doesn’t have any limitations regarding post-editing, like categories, tags, or featured images.

How to use it? Go to Plugins > Add New > Post Duplicator. Don’t forget to install and activate it.

Post Duplicator Install Process
Install Post Duplicator Plugin

Go to the Posts and Pages section to clone any page or posts.

Duplicate Post Feature
Duplicate Post Feature In The Plugin

 

Duplicate a Page in WordPress Without Plugins

Plugins are great for many things, but they can also be a security risk. According to Wordfence, more than 55.9% of websites were hacked due to plugins.

How Wordpress Gets Hacked
Why Wordpress Websites Are Hacked Stats

It’s a good idea to use minimum plugins on your website to keep your website secure. Moreover, you’ll face speed issues since using more plugins tend to make your website slower.

I’ll show you two way: A built-in WordPress file editor and a code-based solution:

Way 1 – Manually Copy-Paste Method

It’s the most common method most people usually know about. However, all you need to do is go to the Code Editor. Code Editor is designed to give you the ability to edit and debug your code directly within the visual editor.

Manually Copy Paste Method In Gutenberg
Code Editor In Gutenberg

Then copy all the existing content along with pieces of code.

Image17
Copy The Content From Code Editor

Now create a new page, shift the page layout to Code Editor.

Code Editor In Gutenberg
Code Editor Location

Once done, paste the code which you copied from the previous page.

Paste The Content In Gutenberg
Paste The Content

Don’t forget to turn the new page into the Visual Editor to view the live changes.

Code Editor To Visual Editor
The Shift From Code Editor To Visual Editor

 

Way 2 – Copy All Content Method

Have you ever wanted to clone a webpage with less effort, as described above? Well, now there is an easier way than copying and pasting content manually.

The ‘Copy All Content’ Method by Gutenberg makes it easy for any user to copy all the content from a page in seconds without having to scroll around the entire site.

To use the feature, click three dots and click Copy All Content.

Copy All Content In Guternberg
Copy All Content Feature

Once you’ve copied, go to the page where you want to paste the content. Then, RIght click and paste the content.

Paste The Content Copied From All Content
Paste The Content

You’re done.

Way 3 – Code Method

Do you love code-based solutions? Code method is one of the finest methods to clone a page without installing a plugin. Moreover, you’re less likely to face compatibility issues in the future as it’s not a plugin that needs to be updated.

Go to Appearance > Theme Editor. Find functions.php usually saved with the name Theme Functions.

Duplicate A Page With Funtions
Steps How To Paste The Code

Now paste the below code snippet into the functions.php at the bottom.

/*
 * Function for post duplication. Dups appear as drafts. The 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 the 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 );
add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);

Once done, you’ll be able to duplicate a page and post effortlessly. On the internet, the last line is not added in the code for adding duplicate page functionality.

Duplicate A Page Feature
Duplicate A Page When The Code Is Applied To Function.php

Are you getting errors this way? You can use the FTP client to edit the functions.php. You might be thinking how? First, install FileZilla that is used to access your server.

Wrapping Up

At this point, you should have a pretty good idea of how to duplicate a page in WordPress.

There are three ways that we’ve covered so far – copy-pasting the content using Gutenberg or copying and pasting the code into another page.

Which method is your favorite? Let us know which one you think performs best for cloning pages on your site.

In addition, if you would like help with duplicating any other types of items in WordPress (such as posts), let us know.

We can provide more information about these different methods and offer advice from our team of experts who specialize in WordPress solutions.

FAQs

Does any plugin allow duplicating custom post types?

You can duplicate all custom post types in WordPress with Yoast Duplicate Post, which has the best duplication functionality.

Do plugins work with Classic Editor in WordPress?

Having said that, I can confirm that all the plugins I mentioned in the this blog post work very well with Classic Editor.

Do plugins retain the SEO settings?

When you use a plugin, all the optimization settings are retained, but when you use the manually method, the title, meta description, and tags are not copied.

Do any of the plugins allow bulk actions?

Yup, Yoast Duplicate Post enables you to bulk duplicate content.

Shares

JOIN OUR MAILING LIST

JOIN OUR MAILING LIST

Master the Art of WordPress

Get exclusive access to how-to WordPress tips, tricks, and tutorials.

Thanks. You have successfully subscribed.

Shakeel Anjum

Master the Art of WordPress

Get free access to exclusive how-to WordPress tips, tricks, and tutorials that I may not publish here because of lack of time but will definitely send them to my awesome subscribers.

Thanks. You have successfully subscribed.

Shares