How To Duplicate A Page In WordPress - 4 Easy Methods (2024)

How To Duplicate A Page In WordPress

You don't want to frequently have duplicate content on your website. However, it is a wise practice to duplicate your pages in order to maintain consistency, or a templated style. Your only concern should be how to complete the task, which is why today we're going to discuss how to duplicate a page in WordPress.

WordPress is a flexible platform, so it makes sense that there are a few ways of how to duplicate a page in WP. There is also a method that will work for you no matter what level of experience you have.

We'll look at four ways to duplicate a page in WordPress in this post. But first, let's explore why you might want to do this in the first place.

The Difference Between "Duplicate Content" and Duplicating a Page in WordPress

Before we get into specific justification, it's important to clarify the difference between duplicate content and creating duplicate pages in WordPress.

Search Engine Optimization (SEO) is related to the latter. Duplicate content refers to a page on your website that contains substantially all of the same content as another page elsewhere on the internet.

Although it might be detrimental, a search engine won't usually penalize you right away for it.

This, however, differs from "copied content," which is a deliberate attempt to "game" search engines in order to rank higher. The consequences are much more severe because it appears to be a deliberate act.

Contrary to everything mentioned above, duplicating your page simply means copying its layout, formatting, and content.

The purpose is to use this duplicate page as the basis for a new one; doing so carries no SEO penalty. Next, let's briefly discuss why you might want to do this.

 

Why Would You Want to Duplicate a Page in WordPress

You'll undoubtedly be aware of the need to duplicate a page in WordPress when it arises. However, it's possible that a more effective strategy would be more advantageous than your current ones for creating posts and pages.

For instance:

  • You have a particular design for your current page in mind that is used on another page of your website.
  • When creating new content, you might create "drafts" of pages that you frequently reuse (for example, blog posts).
  • You want to use specific HTML or CSS code from one layout on a new page.
  • You might want to work on a new version of a page but not have access to the staging functionality (although there are better ways to do this).

In short, you would want to duplicate a page on WordPress in order to start a new post or page without having to enter tags, categories, and formatting again, copy allows you to duplicate a post or page, including the title, contents, tags, and categories.  

A shortcut for duplicating your page would be helpful in each of these scenarios. Let's discuss the recommendations we make for solutions in the section that follows.

How to Duplicate a Page in WordPress (4 Methods)

How to Duplicate a Page in WordPress (4 Methods)

This section discusses how can we go about duplicating pages in WordPress.

Depending on your level of experience, we'll grade the four methods below from relatively simple to moderately challenging. We'll talk about the following:

  1. The best way to manually copy and paste your content (and why you shouldn't).
  2. Use the Block Editor to copy your content.
  3. Install a plugin to make a page twice as long.
  4. To duplicate pages, add code to your functions.php file.

Once we’re done, we’ll then give you some advice for choosing the best way to duplicate a page in WordPress.

1. Copy and Paste Your Content Manually (And Why It’s Not Ideal)

Let's start by talking about the conventional strategy that many people will use. Copying the content and pasting it into a new draft is the "brute force" method for duplicating a page in WordPress.

We'll bet you're in one of the following camps if you're shrugging at the page while reading this:

  • Your website uses scant taxonomy or SEO fields and has a few pages.
  • The page you want to duplicate is not reachable from the site's back end.
  • You haven't found a more efficient solution.

Copying and pasting is probably the best course of action if you concur with either of the first two statements.

Although manually copying and pasting is straightforward to comprehend and use, there are a few drawbacks.

This method won't accurately copy over your site's images, categories and tags, meta descriptions, permalinks, or any hidden components like custom HTML.

Step 1. Copy the Text From the Original Article

Here, CTRL-A is your friend, and the procedures aren't difficult either:

  • Access the contested website.
  • Copy the highlighted text.
  • Add it to your new draft by pasting it.

Even the most "tech-deaf" person should be able to understand this. The next stage is a little bit trickier, though.

Step 2. Remove Tags From Your HTML

Be aware that you might need to reapply heading formats and remove extraneous HTML from the back end depending on your source and target drafts.

Once you've copied the content over, go to your page's code editor to do this. Users of the Classic Editor should select the Text tab...

The Classic Editor's Text screen.

Users of the Block Editor should go to the Code Editor instead:

The Block Editor's Code editor screen.

It is wise to remove any   or span> tags you discover after this. Our recommendation is to look at a page that isn't duplicated and to follow the layout and structure of the code.

Given the work, it might take longer than one or two pages, and with each manual repetition, the risk of introducing mistakes increases.

If you want to efficiently duplicate a page in WordPress without making mistakes and wasting time, it is preferable to take into account another of the options on this list. 

2. Consider Using the Block Editor’s Functionality to Help You Duplicate Pages

Given that the majority of the disadvantages still apply, using the Block Editor in WordPress to duplicate a page is more appropriately described as a "semi-manual" method.

To duplicate a page from your own WordPress site, open the page and select More tools & options from the menu in the top right-hand corner of the screen:

Using the Block Editor’s Functionality to Help You Duplicate Pages

Open this menu, then click the Copy all content button under the Tools section. From here, you can copy the content and paste it into a new draft to work on. It's still not the most effective method for duplicating a page in WordPress, though.

3. Use a WordPress Plugin to Duplicate Your Page

Use a WordPress Plugin to Duplicate Your Page

Duplicating pages is one of the many WordPress tasks that can be accomplished using a plugin.

Here, your first task is to select an appropriate item. Look for plugins that have been updated recently, are compatible with your version of WordPress, have positive ratings, and have received a lot of positive reviews (at least four stars).

Several suggestions are made here. Both Yoast Duplicate Post and Duplicate Page or Post have received positive reviews and are regularly updated. To illustrate, let's use the Duplicate Page plugin, which is arguably the best option on the market right now:

Once it has been installed and activated, go to WordPress' Pages > All Pages screen. From here, look for a "copy" button by hovering over the page you want to copy. Duplicate the website:

The page in question will be duplicated by clicking this; job done!

4. Add Code to Your functions.php File to Duplicate Your Page in WordPress

Add Code to Your functions.php File to Duplicate Your Page in WordPress

Though it might be the most difficult to implement, our final approach provides the most flexibility. It's a great idea to add code to your functions.php file for a variety of tasks, including WordPress page duplication.

A link can be added directly to the Pages dashboard screen, ensuring that it is always accessible. But first, you'll need to get a few things ready:

  • An appropriate text editor. Even the built-in text editor will suffice in an emergency. Atom, Sublime Text, and Notepad++ are all free (or have free trials).
  •  A client for the File Transfer Protocol (FTP). You can access your website in a pleasant manner using FileZilla or CyberDuck, which are both excellent options. Additionally, your hosting company might provide a File Manager, which accomplishes the same task.
  • Server access for your website. Typically, you can find the credentials for this in your hosting control panel or in an email that was sent to you when you first bought an account.
  • The ability to FTP-manage your website. The Make WordPress website has a great FileZilla tutorial that can be applied to other clients if you need to brush up on this.
  • An offshoot of your current parent theme. We've previously talked about how to do this, and it helps preserve your changes when updates are made.

When you're ready, launch your FTP client and proceed as directed!

Step 1. Open Your functions.php File

Open Your functions.php File

First, use your FTP client to log into your website, then search for the wp-content > themes folder:

Your child theme's folder with a functions.php file ought to be there. In the event that it is missing, you will need to create it first. Editing comes next.

Step 2. Add Code to Your functions.php File

You should add the following code once your functions.php file is open. It ought to target all other code that might be present there:

/* 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'] = 'Duplicate';
        }
        return $actions;
    }
    add_filter('post_row_actions', 'rd_duplicate_post_link', 10, 2 );
    add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);

Save your changes after adding the code, then disconnect from your FTP connection.

Step 3. Check You Can Duplicate a Page

Check You Can Duplicate a Page

Go to your Pages screen after refreshing your back end. The duplication link will reappear as before:

Although it works well when placed inside your child theme's functions.php file, with the right knowledge you could easily turn this into a plugin and expand on the functionality even further.

How to Choose the Right Method to Duplicate Your Page in WordPress

The propensity to choose the quickest solution when duplicating your pages makes sense. Nevertheless, based on your requirements, you might want to take a closer look at a more complicated option.

The best option for the majority of users who just need to duplicate a page in WordPress is going to be a plugin. When required, you can install and activate it, and it will provide you with the functionality you require (and more in some cases).

However, hardcoding a solution to duplicate your pages in WordPress makes perfect sense if you're a heavy "duplicator," possibly with complex needs. It will always be available and provide a tailored experience according to your requirements.

Of course, depending on those needs, there may also be a budgetary consideration, but if you're getting the functionality you want, the money is well spent.

IMH

Do you want a fast website?

Who am I kidding? Don't we all?

So why do so many of us struggle?

The biggest challenge is usually finding a fast, reliable hosting company.

We've all been through the nightmares - support take takes forever or doesn't resolve our problem always blaming something on your side... 

But the biggest bummer is that the website always feels slow.

At CollectiveRay we host with InMotion hosting and our website is stupid fast. We run on a custom stack of LightSpeed server setup on MariaDB with a PHP7.4 engine and fronted through Cloudflare. 

Combined with our front-end optimizations we reliably server 6000 users every single day, with peaks of 50+ simultaneous users. 

Want to get a fast setup like ours? Transfer your site for free to InMotion hosting and get our 50% OFF on current pricing.

Try InMotion Hosting with 50% OFF for CollectiveRay visitors in April 2024 ONLY!

InMotion hosting 50% OFF for CollectiveRay visitors

Wrapping Up

The process of duplicating a page in WordPress appears to be as simple as clicking a button. Depending on your background and knowledge, some strategies may appear to be much more difficult than others.

In this article, we've looked at four, varyingly challenging methods for duplicating a page in WordPress. Let's sum them up quickly:

  • Copy and paste your content by hand, but be aware that if you have many pages, the process will take some time.
  • Use the built-in Block Editor feature as an alternative, though a more durable solution is preferable.
  • Use a plugin to duplicate your pages the old-fashioned way, like Duplicate Page.
  • Open a text editor and add the code to the functions.php file for WordPress.

Duplicate A Page In WordPress FAQs

What is the difference between duplicate and clone in WordPress?

Any of these functions, when clicked will produce a copy of the page with some minor variations: Clone: duplicates your WordPress post or page without launching the cloned content's editor. New draft: duplicates the content and launches the editor, allowing you to start working immediately.

What plugins for Wordpress page duplicators do I need?

Yoast Duplicate Post and Duplicate Page are two WordPress plugins that we advise using because they essentially accomplish the same task. You don't need both, despite their confusing names, as each works with pages and posts. Whichever one you decide on, you'll have to install and activate it on your website.

How do I duplicate a page in the WordPress editor? 

  1. To copy a post or page, click the ellipses menu (the three vertical dots) that is located to its right.
  2. Choose Copy.
  3. A new post with duplicate content will be created as soon as the WordPress Editor opens.
About the Author
Daniel Luke
Daniel is a web designer and developer. He has been a developer for the last 10 years working with various WordPress themes that allows him to compare and contrast different themes, understand the strengths and weaknesses to develop factual, real-world reviews. He is also a mobile app developer and technology reviewer. Over several years, he has developed his own mobile apps, both on Android and iPhone. This hands-on specialisation in mobile and web development allows him to be an authoritative voices when it comes to technology reporting.

One more thing... Did you know that people who share useful stuff like this post look AWESOME too? ;-)
Please leave a useful comment with your thoughts, then share this on your Facebook group(s) who would find this useful and let's reap the benefits together. Thank you for sharing and being nice!

Disclosure: This page may contain links to external sites for products which we love and wholeheartedly recommend. If you buy products we suggest, we may earn a referral fee. Such fees do not influence our recommendations and we do not accept payments for positive reviews.

Author(s) Featured On:  Inc Magazine Logo   Sitepoint logo   CSS Tricks logo    webdesignerdepot logo   WPMU DEV logo   and many more ...