How to Duplicate a Page in WordPress: 3 Simple Methods


Published at wordpress page management by Elle Holder on 20th Dec 2021

Crafting the perfect WordPress post or page can take a lot of time. They’re often a few thousand words in length and can contain a lot of media. What if you find yourself in a situation where you want to make a copy of that post or page? There are a lot of reasons why you might want to do that. So I’m going to share how to duplicate a page in WordPress.

In older versions of WordPress, you could right-click and Select All. This wasn’t the best way to duplicate a page in WordPress, but it was better than nothing. But with the introduction of the Gutenberg block editor, that functionality was lost. And was very much missed.

Fortunately, the more recent versions of Gutenberg have provided a feature where you can Copy All Content.

But there is a better way.

Table of Contents

1. Is a Duplicate Page in WordPress the Same Thing as Duplicate Content?
2. Reasons to Duplicate a Page in WordPress
3. Methods on How to Duplicate a Page in WordPress
    Use the Built-in WordPress Copy All Content Function
    Duplicate a Page or Post Using a Plugin
    Use Code to Duplicate a WordPress Page or Post

1. Is a Duplicate Page in WordPress the Same Thing as Duplicate Content?

Copy Paste

Source: Pixabay

People who are new to SEO or don’t understand it, tend to get themselves all wound up when it comes to duplicate content. So let’s address and reassure you that creating a duplicate page in WordPress will have no impact on your SEO attempts.

According to Google Search Central, they look for pages or blocks of content that have been deliberately duplicated to another domain, where the goal is to manipulate search rankings.

When we talk about how to duplicate a page in WordPress, we’re not necessarily talking about copying everything on the page, including content. However there may be circumstances where you do want to copy content as well, only because it would be easier to make necessary changes on another page than to start from scratch and rewrite an entire page.

For the most part, when duplicating a page or post in WordPress, the goal is to copy more than just content. You’re also interested in carrying over your layout, formatting, and structure to a new page as well. As long as you aren’t doing that and publishing the entire duplicated page, content and all, you don’t need to worry about what Google refers to as duplicate content.

2. Reasons to Duplicate a Page in WordPress

So under what circumstances might you be wondering how to duplicate a page in WordPress?

First, because you believe in working smarter, not harder, and you realize that time is money, so you’re not likely to waste your time on repetitive tasks and redundant work that robs you of time and money.

Perhaps you have a page on your site that addresses specifics about your company, industry, customers, and market. But that same page contains outdated information and needs to be updated. Why would you spend time rewriting the entire page if only segments of it required a rewrite?

Instead, you would do the sensible thing and duplicate that page.

Another possible scenario is that your page is still a work in progress. Perhaps you have a few different layout or structure ideas. In that case, you might want to have multiple duplicates of a page in WordPress. One as a backup and a few as working copies, each taking you in whatever direction you want to take it until deciding on the page you intend to publish.

Or maybe you want to create two versions of a page to do some A/B split testing. Marketers do this all the time. Imagine how much time it would take to start from scratch to recreate every page.

3. Methods on How to Duplicate a Page in WordPress

If you want to duplicate a page in WordPress, you have several methods to choose from. From the very primary built-in option that WP offers, to adding code to the core files.

I’ll walk you through each method below.

1. Use the Built-in WordPress Copy All Content Function

As the name suggests, when you use this option, all you’re copying is your content. So if you’re looking for a way to copy everything, including your page or post title, categories, tags, featured images, none of that is copied. Only the content within the blocks is copied.

Steps using the WordPress Block Editor

1. Head to a post or page you’d like to duplicate in WordPress. If you don’t already have it, open, find it, and select the edit option.

2. Find and select the 3-dot menu in the top right.

3. Find Tools in the menu below and expand if necessary.

4. Select Copy All Content

5. Create a new page or post and paste your content. You’ll need to create a title and save it as a draft.

WP Copy all Content

It’s as simple as that, but remember, you’re only copying your content. If you have SEO or other plugins with fields that you’ve filled, or settings or options you’ve made in the sidebar, they have not been saved.

But what if you’re still using the Classic Editor? Is it still possible to duplicate a page in WordPress? Yes, it is! But you’ll be using a browser function, not a native WordPress function.

Steps Using the WordPress Classic Editor

1. To duplicate a page in WordPress, find it and select the edit option.

2. Once you have your post or page open in edit mode, make sure you’re in the text editor, not the visual editor.

3. Select the text of your post or page.

4. Right-click your mouse to open the browser’s menu and select copy.

4. Create a new post or page and while in the text editor, place your cursor in the field and paste your content.

Classic Editor Copy Post

2. Duplicate a Page or Post Using a Plugin

There are several options if you would like to duplicate a page in WordPress plugins. Here are just a couple.

Yoast Duplicate Post

Yoast Duplicate Post Plugin

This is one of the most popular plugins to duplicate a post in WordPress. And it comes with some excellent features. Like allowing you to choose what elements of your post or page you’d like to copy. Because that may vary by situation or user.

Once you have the plugin installed, head to the plugin settings page, you can access it from your Dashboard > Plugins >Installed Plugins > Yoast Duplicate Post >Settings.

Once there, you will see you have three separate tabs of settings. For the most part, everyone should leave the default options in play, but some might want or need a bit more flexibility.

Choose your options in the What to Copy Page:

Yoast Duplicate Post Options

You’ll also have options to exclude certain taxonomies. Such as categories and or tags. Find and adjust those at the bottom of the page.

Once you have finished updating the options in this section, move over to the Permissions tab.

Yoast Duplicate Post Permissions

Here, the default settings allow only the administrator and editor to create duplicate posts or pages. However, you can give team members who fall into author and contributor roles permission to duplicate as well, if necessary.

Note, if your site has custom user roles, they will be listed here as well.

And if you need to more than duplicate a page in WordPress you can update your settings to allow cloning of feed sources, feed items, and blacklisted items.

Note, if your site has custom post types, they will show in this section too.

Make and save your changes, and then move on to the Display tab.

Yoast Duplicate Post Display Settings

Here you have the settings to choose where you want to put your duplicate post links. The default settings are fine.

If you do make any custom selections, save your changes and close out of settings. Now you’re all ready to duplicate a page in WordPress.

This plugin offers two options. You can either clone an existing post or page as shown by the arrow above, or you can use the New Draft link beside it to duplicate and edit an existing draft.

Yoast Duplicate Post Clone

You also have the option to create a copy or clone of a post or page while in the edit page/post view. Simply look to your right sidebar and click on the Copy to a New Draft in as seen below.

Yoast Duplicate Post New Draft

What about times when you might need to duplicate a page in WordPress in bulk? There is an option for that too.

From your dashboard, check off all the titles you want to make a copy of. Then, under Bulk actions select Clone and then apply your action.

Yoast Duplicate Post Bulk Option

Duplicate Page Plugin

Duplicate Page Plugin

Here’s another plugin alternative to duplicate a page in WordPress.

The Duplicate Page Plugin is available in both free and paid Pro versions. And it makes duplicating posts or pages easy. The first thing you want to do is head to your settings page. This is especially important if you use the Gutenberg block editor.

The default editor setting is the Classic editor, so you want to duplicate a page in WordPress and you use Gutenberg, you want to change the Choose Editor setting to either All Editors or Gutenberg Editor. You can also change the other settings if necessary. Then click save changes.

Duplicate Page Settings

Once your settings are updated, you can simply find the Duplicate This link via your WP dashboard and click it.

Duplicate Post Duplicate This

Alternatively, you can also find the link when you have your page or post editor open.

Duplicate Page Post Editor Link

In order to get the following additional options, you will need to purchase the pro version.

  • Use permissions to restrict access to certain types of users
  • Change post titles
  • Change post prefix
  • Change post suffix
  • Show duplicate page link in post types
  • Redirect clone links   

3. Use Code to Duplicate a WordPress Page or Post

The final way I’m going to show you how to duplicate a page in WordPress will likely be the most difficult for some. If you’re intimated by finding and editing your functions.php file, this isn’t for you.

If you’re willing to go ahead, I urge you to take a backup of the file before proceeding. You can use a tool like WPBlazer to do so.

This method will create a link right on your Pages dashboard.

There are a few things you need before proceeding with this method. This is my preferred way.

  • An FTP (File Transfer Protocol) Client. First, check to see if your hosting provider offers a client with your subscription. If not, both FileZilla and CyberDuck or good free options
  • Access to your website’s server. When you signed up with your host, they would have emailed you welcome info which would have included the credentials you need to access the server
  • Knowledge of how to upload via FTP. If you’ve never used FTP before, look for a user manual for whatever software you’re using
  • A child theme. Never, never, never make changes directly to your theme. All customizations will be lost if and when the theme developers update it. Instead, create a child theme and make all changes to it

That’s the long way to get to and edit your functions.php file. But you can also create a child theme and then access its functions.php via the Theme Editor in your WP Dashboard

WP Theme Editor

However you get to the file, once you’re there, you need to add the following to the end of it. Remember, make sure you create a duplicate of it before making any changes!

/*
* 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'] = '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);

The last two lines of that code make it possible to duplicate a page in WordPress as well as a post. If you are only interested in one or the other, you can delete the corresponding line.

And that’s it! Multiple ways to duplicate a page in WordPress.

Conclusion

There are many reasons to want to duplicate a page in WordPress. Maybe you want to use a page as a template. Maybe you’re testing out design preferences.

Even though I provided a walkthrough on how to duplicate a page in WordPress using both plugins and via your functions.php file, you do have more options and setting variables if you go with one of the plugins mentioned above.

If you do decide to go the plugin route, why not look into using a WP management tool like WPBlazer before you do. It’s a great way to manage your site’s plugins.