How to duplicate WordPress pages and posts?

How to duplicate WordPress pages and posts?

When you are working on your WordPress website, you may find yourself having to quickly copy a page or post. For example, a page with a lot of material you can reuse, or an older article that can be expanded into a new one. You can save hours of your work time cloning reusable pages and posts.

In this article, we will show you how to easily duplicate a WordPress page without affecting the original existing version.

Let’s jump right in!

There are four different ways you can use to easily duplicate your WordPress pages or posts: using block editor functionality, via functions.php coding, WordPress duplicate post plugins, and by using page builders functionality.

The scope and use cases of the possible solutions differ, but you’ll almost definitely be able to find one that meets your requirements. In WordPress, duplicating a page or post is not just copying and pasting the content. You can save lots of time when designing your website or upgrading your content by keeping the page template, SEO info, and photos. This isn’t a challenging job but it can be confusing for beginners since WordPress lacks native duplicating features.

What is Cloning and Why you’d want it on your WordPress website?

Cloning refers to the process of creating a fully operational copy of a page, post, or the whole website. It is different from website backup where you create inoperative website copy for safekeeping which can be used to restore your website.

You’ll most certainly be aware of whether you need to duplicate a page in WordPress. However, it’s possible that a more effective solution to generating posts and pages will support your current methods.

Consider the following situation when cloning can come in handy:

  • You have ‘drafts’ of pages that you can use again and again while making new content.
  • You want to use custom HTML or CSS code from a previous layout on a new page.
  • You may want to focus on a new version of a page but don’t have access to staging features.
  • You want to extend an older article to a new article.
  • You have a style in mind for your current page that you want to use on other pages on your website. For instance, the sales page you have designed fits perfectly for other websites you are working on with little changes. You can duplicate the page and use it on your other websites. But we highly recommend modifying the page so that it won’t be the same as the original page.
  • Setting up staging website for testing major updates and website migration purposes.

Although cloning has a wide scope, we will only focus on coping or duplicating WordPress posts and pages.

Duplicating posts and pages in WordPress

In simple terms, duplicating a page involves copying the formatting, structure, style, and text. The idea is to replicate an existing post to create another similar post for testing purposes or create new live pages while avoiding SEO penalties. For example, product pages or sales pages are reusable with some changes to them and they need to rank on different keywords.

What would you do if you need to make changes to a live WordPress page without disrupting the user experience and risking the page’s functionalities?  You simply make a copy of the page, make the required changes, test the page and then implement the changes on the live page.

At times, creating a duplicate version of a WordPress page will help you handle content more efficiently. And in this article, we are just going to do that right so you can just copy the page or post with a few clicks and start working on it.

4 Ways to create WordPress duplicate pages and posts

You can use block editor functionality, add codes on functions.php file, use page duplicate plugins or utilize page builders features to duplicate posts and pages. We’ll walk you through these four techniques you can use to duplicate a page step by step.

But first, we’ll teach you how to replicate a page or post in WordPress without using a plugin in a semi-manual manner. This requires copying and pasting, but WordPress makes it so simple that if you only have one article to copy, this would actually be faster than adding a plugin and doing it that way.

We’ll go from comparatively straightforward to moderately challenging for the four ways below, based on your practice. Here’s what we’ll cover:

  • Cloning pages and posts with block editor functionality
  • Duplicating posts and pages via functions.php with code
  • Duplicate a page or post using a plugin.
  • Bulk Duplicate WordPress Pages
  • Duplicating posts and pages using page builders(Elementor, woo commerce-product duplicator feature)

Cloning pages and posts with block editor functionality

Using the Block Editor to duplicate a page in WordPress is more of a “semi-manual” approach.

This method is available for Gutenberg and is best for copying portions or entire content blocks on the page.

For a few blocks on posts and pages, you can simply use the “control + C” or copy option to copy blocks and “control +V” in windows and “Command +V” in mac to paste the blocks.

To Clone the entire page you can follow the steps below:

Step 1: Copy all Content

At the top right of the editing screen, press the three dots arranged on top of each other. There will be a menu. You’ll see a Copy All Content selection at the bottom of this menu.

Theme Editor - cloning pages or post

Step 2: Create a new Post

When you click it, you’ll see a note stating that your content has been copied. Build a new post now. Give your post a title, then click on the first empty block on the editing screen that has been created for you.

Step 3: Paste the content

Paste it from the shortcut menu that appears. Your previous post’s content will now appear in your latest one. You can now edit the article to make it unique from the previous one.

Note: Making blog posts that are exact duplicates of each other on your web is bad for your website. Remember to make necessary edits on the content you just copied, add appropriate title and SEO meta to the page.

Duplicating and pages via functions.php with code

You can duplicate WordPress pages and posts without using plugins by manipulating some codes. Although this approach seems to be time-consuming, it is really very straightforward.

Before modifying any WordPress files, we highly advise you to make a copy of your website.

First, go to your FTP client to access your site and search for the wp-content > themes folder:
Your child theme’s folder, which should contain a functions.php file, should be inside. It might be missing, in which case you’ll have to build it. The next step is to edit it. You’ll have to apply the following code to your functions.php.

The following code snippet will enable you to duplicate posts in WordPress:

/* Duplicate posts and pages function. Duplicates appear as drafts, and 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;
/* This gets the original post or page ID */
$post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
/* …then grabs the original post data. */
$post = get_post( $post_id );
     
/* To select another user as the post author, use $new_post_author = $post->post_author;. Otherwise… */
$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;
     
/* If the post data exists, create the duplicate */
if (isset( $post ) && $post != null) {
    /* Create a 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 using wp_insert_post() */
        $new_post_id = wp_insert_post( $args );
     
        /* Get all current post terms, then set them against the new 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 of the post metadata */
        $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);
        }
     
        /* 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);

Simply copy and paste the code into your functions.php file. You can do this with File Manager, FTP client, or the built-in WordPress file editor.

If you choose to use the third option, go to Appearance -> Theme Editor and choose Theme Functions from the drop-down menu.

If the code above is correctly embedded, you should now see a Duplicate button in the All Posts or All Pages menu.

Duplicate a page or post using a plugin.

Duplicate page plugin- activation and installation

Duplicating pages, like almost anything else in WordPress, can be done with the plugins. The only way to repeat a WordPress post is to use a plugin. The Duplicate Page plugin will be used in this explanation. Of course, there are plenty more that you can use.

This plugin helps you clone a page, it is easy to use, simple, and saves you a lot of time. This plugin allows users to clone posts of any type, or copy them to new drafts for further editing. With the Duplicate Page plugin, you can duplicate your posts, pages, and custom posts with just one click and it will save you lots of time.

Duplicate Page comes with a few extra features that other cloning plugins don’t. Blogs, websites, and custom post forms can all be duplicated by this plugin. You can also save the copies produced as drafts, pending, public, or private.

Step 1:

First Install and Activate Duplicate Page Plugin.

duplicate page plugin install page

Step 2:

Go Select to Duplicate Page settings Menu from Settings Tab and configure its settings to meet your needs.

duplicate page plugin setting panel

Step 3:

Then Create New Post/Page or Use the old one.

creating a post or page in wordpress using duplicate page plugin

Step 4:

After clicking on duplicate this link, then duplicate post/ page will be created and saved as a draft, publish, pending, private depending upon settings.

created duplicated page

There are other plugins as well that you can use to duplicate your page. To name some: Duplicate Post, duplicate page and post, post duplication, WP Post Page Clone, and more. In WordPress, it is very easy to clone the page. You can install a plugin and simply just duplicate the page, similarly you can duplicate your post too. You can do so many things in WordPress with a variety of plugins. But you can also duplicate your page with other processes, you can duplicate the page by editing the funtions.php file or copying and pasting the relevant code.

Bulk Duplicate WordPress Pages

To bulk Duplicate WordPress Post or pages you need to install Yoast Duplicate Post:

yoast bulk page duplicator

After you activate the plugin, follow these posts:

Step 1:

Go to the Posts or Pages section of your WordPress dashboard after you’ve enabled the plugin. Locate the content that you’d like to duplicate. There should be two new options available to you.

yoast duplicate post plugin use- step 1

Step 2:

New draft and clone, both duplicate your tab but there are differences. Clone creates a draft copy of the post while maintaining the same list view. In the new draft, it creates a copy of the post and opens it in the WordPress dashboard as a new draft. You can instantly begin working with it.

yoast duplicate post plugin-cloning multiple pages -step 2

Step 3:

So, if you want to start working on your duplicated page right away, press New Draft to save a click. Aside from that, there isn’t much of a difference. You may use the checkboxes on the left to pick multiple pieces of content if you choose to replicate multiple WordPress posts or pages. Then, in the Bulk Actions drop-down, select Clone to clone all of the content you’ve created.

The time saved by not needing to duplicate a page will be put to greater use in other areas of the company. Simply placed, duplicate page plugins for WordPress are a game-changer. All of the methods in this article would help you duplicate every WordPress page with a single click, using a plugin.

Duplicating post and pages using page builders(Elementor, woocommerce-product duplicator feature)

WooCommerce

WooCommerce is an eCommerce plugin. However, it’s important to note that WooCommerce allows you to duplicate items without the need for a separate plugin. So, before you go looking for a post duplication plugin to use to duplicate your stuff, take advantage of WooCommerce’s built-in functionality.

wocommerce-product page or post duplicate

If you go to WooCommerce’s main Products screen and hover your mouse over some object, a Duplicate connection will appear under that article.
Simply click on the Duplicate connection to generate a new product. You’ll be led directly to the new product’s editing pad, where you can make modifications and then post it.

Alternatively, you can duplicate product page,

It’s worth remembering that the slug for the new product will be the slug for the old product with -copy included, so you’ll need to edit the slug even though you modify the new product’s title.

How To Duplicate An Elementor Page

Save your designed page as a template, and then import the template into other pages as required to duplicate a page built with Elementor.

Step 1:

To access the Save Options, click the arrow next to the UPDATE button. Select Save as Template from the drop-down menu.

duplicating elementor page- step 2

 

Step 2:

Give your page template a name and press the Save button.

duplicating elementor page- step 2

Step 3:

Into A New Page, Import A Saved Page Template. From the Elementor Editor, choose “Add Template”.

duplicating elementor page- step 3

Step 4:

Then click, My Templates. Select the import next saved page template you want to use and then click Import.

duplicating elementor page- step 4

Step 5:

Then, a pop-up will appear. Click Yes and the template will be pasted.

duplicating elementor page- step 5

Now, your page or post is duplicated and you can proceed with small changes.

Wrapping up

Duplicating a page in WordPress is a smart way to boost your workflow if you have a busy blog or sales pages that have proved to perform. It’s useful to have a risk-free solution when dealing with various elements, from coding to templates to text. With the Duplicate Post plugin, you can make complete duplicates of your current content with only one touch.

We hope that this guide about how to duplicate a post or page in WordPress has answered all of your questions. To begin, you can use the built-in Block Editor or you can manually copy and paste the stuff, but that takes a lot of time if you have a lot of pages. Second, you can use a WordPress plugin to duplicate a page or post. You can still do so without using a plugin. All you have to do is go to WordPress’s functions.php file and paste the code we’ve provided.

You may be interested in

Save 40% on Home Services Pro - Black Friday & Cyber Monday Super Sale Deal! Coupon code "BLACKFRIDAY2022"

X