Step-by-Step Guide to Easily Duplicate Pages in WordPress

Last Updated on December 31, 2023 by Sunny Staff

There are plenty of reasons to duplicate a page in WordPress. Unfortunately, the world’s most popular content management system (CMS) doesn’t come packed with native page duplication functionality. Below, you will find a method to duplicate pages and posts using a plugin and a way to add page duplication functionality to WordPress with just a bit of code.

In This Post

When Should You Duplicate Posts or Pages in WordPress?
Three Ways to Duplicate Posts or Pages in WordPress
Duplicate Page FAQ

When Should You Duplicate Posts or Pages in WordPress?

But should you always duplicate posts and pages in WordPress, or should it only be used in certain circumstances? Here are a few times when post or page duplication is the best course of action:

  • One of the best uses of page or post duplication is to build your multilingual site. Create a page in one language, then duplicate it. Replace content in one language with content in your other languages, and presto!
  • You infrequently need to create new pages based on existing pages so that they share portions of content. If this is done frequently, consider using templates instead.
  • You want to ensure design consistency. Page duplication is one way to ensure that all or only related pages (e.g. all service pages) use the same page layout.
  • You want to test features or new page layouts. Ideally, you’d use a staging site, but sometimes it’s just a little more convenient to clone an existing page.

Keep in mind that working with duplicate posts and pages requires careful management to avoid a buildup of unused duplicates. Similarly, remember to change your cloned posts and pages enough to satisfy search engine requirements for unique content. Too many published pages with content that’s too similar could negatively impact your search engine rankings.

Three Ways to Duplicate Posts or Pages in WordPress

Page and post content is stored by default in the post_content field within the wp_posts table.  If you’re using a page builder, it may store page content in its database tables, which means some or all of the methods below may not work. Most popular page builders do however support the use of templates or global template parts, which can be used to duplicate designs and content across multiple pages and posts.

1. Duplicate Page Manually: Copy & Paste

There is a way to duplicate page content without a plugin or adding extra code to your site, albeit a little limited:

If you’re working with the block editor, WordPress includes a Copy All Blocks feature that copies all on-page content. Navigate to your new page and simply paste the copied blocks with CTRL+V.

Copy All Blocks

If you’re using the Classic Editor, you can easily copy the on-page content by clicking on the Text tab of the editor, and then copying and pasting the code into a new page.

Classic Editor Text

In cases where you simply need to duplicate the content of a few pages, the manual way of doing things may prove more efficient than installing a plugin or adding code to your functions.php file.

2. Duplicate Page Using a Plugin

Plugins often make life easy, and it’s no less true when you need clones of posts or pages. Luckily, there are many freely available plugins capable of doing the job.

Duplicate Post

Active Installations: 200,000+

For this tutorial, we installed the Duplicate Post plugin which promises to also duplicate page builder content. Since the plugins we list below are very similar in functionality, we’ll use the Duplicate Post plugin to show how easy it is to duplicate a post or page in WordPress.

Copy Delete Posts

From the screenshot above, you can see that Duplicate Post comes packed with a bunch of features. Copy directly from the post / page list screen (and choose how many copies!), from the post edit screen, or from the admin bar.

You can tweak the copy process from the settings page located in the WordPress admin panel under Copy & Delete Posts.

Copy Delete Settings

Here you have the option to choose which post meta information (title, date, publishing status, slug, format, author, etc.) and content should be copied to your new post. You can also choose a naming convention for your copied posts, which can include a counter, the current date, and the current time, as well as custom prefixes and suffixes. (The free version comes with a ‘Default’ settings profile, while additional settings profiles can be created in the premium version.)

When you’ve tweaked the settings to your liking, head on over to the post or page you want to duplicate. In the example below, I’ve opened up the default Sample Page and then clicked on Copy this. You’ll again be presented with the settings screen where any last-minute changes can be made. When you’re ready, click on Copy it!

Copy It

Now when you navigate back to the list of posts or pages, you’ll see your duplicate(s) in the list:

Duplicated Page

This process works on WordPress posts and pages, as well as custom post types. It was also tested successfully with Elementor Pro page builder. However, not all page builder tests were successful; with themes and plugins that use their own database tables and fields to store page data, the plugin failed to duplicate the page content.

Other post / page duplication plugins

Yoast Duplicate Post

Active Installations: 4+ Million

Yoast Duplicate Post

The Yoast Duplicate Post plugin (by the same company that develops the Yoast SEO plugin) is a feature-rich page / post cloning plugin that supports many of the same features as the Duplicate Post plugin above, and then some.

Easily choose which meta fields to duplicate along with the post or page content. This can include title, date, status, slug, excerpt, template, post format, author, password, attachments, etc. You can also choose which meta fields not to duplicate.

Naturally, you can specify prefixes and suffixes to ensure that your duplicate posts and pages all have unique titles.

What sets the Yoast Duplicate Post plugin apart from its counterparts is that the permissions tab on Settings > Duplicate Post can be used to specify which post types cloning functionality should be applied to, and which user roles should be able to duplicate posts and pages. Go to the Display tab to select which links (e.g. Clone, New Draft, Rewrite & Republish) are displayed, and where they are shown.

Duplicate Page

Active Installations: 3+ Million

Duplicate Page

Go to Settings > Duplicate Page to tweak Duplicate Page’s settings. The free version of the plugin is sparse on features, while the Pro version lets you determine which user roles can duplicate or clone pages, posts, and other post types. And, of course, much more.

Head over to the list of posts or pages, and click Duplicate This to duplicate your desired post, page, or custom post type.

Duplicate Page and Post

Active Installations: 100,000

The Duplicate Page and Post plugin focuses on speed and efficiency rather than being feature-heavy – perfect if you’re looking for something that won’t impact your site’s speed, and that has a smaller code base for added security. The Duplicate Page and Post plugin can be used to:

  • Duplicate pages, posts, and custom post type items
  • Duplicate content created with the Classic Editor as well as the Gutenberg editor
  • Choose a custom suffix for duplicate posts / pages
  • Redirect after creating duplicates

Duplicate Page Post

The settings page for the Duplicate Page and Post plugin can be found under Settings > Duplicate post.

3. Duplicate Pages Using Custom Code

As a third option, you can use custom code to add page duplication functionality to your WordPress website. Keep in mind, however, that custom code may have to be maintained as PHP and WordPress versions change. Use custom code when you have the skill set to maintain it, or a WordPress specialist like SunnyHQ in your back pocket to keep an eye on your site and its customizations.

As always, create a full backup of your site’s files and database before making any changes.

Here’s how to add the duplicate page custom code to your theme’s functions.php file:

From your site’s WordPress dashboard, navigate to Appearance > Theme File Editor and choose the Theme Functions (functions.php) file in the right-hand panel.

Edit Functions PHP

Then paste the following code (courtesy of Bojana Raonic @ webnus) at the bottom of your functions.php file:
/*

* 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 and 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('page_row_actions', 'rd_duplicate_post_link', 10, 2);

When you’re done, save your functions.php file and duplicate a page, post, or custom post type to test it out.

Duplicate Page FAQ

Can pages be duplicated in WordPress?

WordPress does not include a native page duplication feature. However, the WordPress plugin repository contains several page duplication / cloning plugins. We’ve listed some of the best ones here.

What’s the easiest way to duplicate pages in WordPress?

Page duplication / cloning plugins provide point-and-click functionality to easily create copies of existing pages. These plugins usually come jam-packed with extra features that make it easy to customize the duplication process to your needs. This can include creating a virtually unlimited number of copies, specifying a naming convention (and automating naming), and what meta information to include or exclude.

What’s an alternative to duplicating pages in WordPress?

In some cases having duplicate posts or pages can be useful, such as when you’re stress-testing your WordPress website. But if it’s simply to save time when creating new pages or posts, you might find that using templates could improve the process and reduce the potential for clutter. Templates can be created for the WordPress Classic Editor and the Gutenberg Block Editor. It’s also a feature generally available in page builders.

What happens to shortcodes and custom fields when a page is duplicated?

Shortcodes and custom fields should continue to function as expected on duplicated pages and posts. The exception here is in instances where custom fields are configured or coded to be unique or context-specific (like referencing a page ID or unique identifier). The same can apply to shortcodes, for example when a shortcode is pulling data from a specific source or based on page-specific criteria.

Are there any limitations when duplicating custom post types or pages built with a page builder?

While there are no limitations when duplicating custom post types of pages built with a page builder, there could be issues with the duplicated page. Such issues can occur when the page builder or custom post type uses unique methods to store data, or when it relies on dynamic data to populate the page.

Which page or post duplication plugin should I use?

Since they all do pretty much the same, there’s no right or wrong choice. However, if duplicate pages or posts are something you won’t need all too often, we suggest opting for a simple and lightweight solution. If you’ll be duplicating pages and posts frequently, choose one of the feature-rich plugins capable of taking care of small and repetitive tasks.

Need a Professional Solution?

Whether you’re using a plugin, custom code, or page templates, we’ll happily manage your entire WordPress website and keep it free from unused duplicate posts and other clutter. But we can also help you streamline workflows with staging sites and page templates for the different types of content you regularly publish.