5/5 - (1 vote)

Don’t waste time duplicating each page in your WordPress site manually. If you have an intention to duplicate many pages, let us show you 2 solutions to duplicate Pages in WordPress in an easy and time-saving way.

When do you need to duplicate Pages in WordPress?

Sometimes, you need to duplicate pages in WordPress to showcase different content but in the same page layout. You may do that manually, which means you have to copy the template and the SEO elements including meta descriptions and title tags. And this process is repeated many times which takes your time and effort.

If you need another solution that is more convenient and time-saving yet still highly effective, a suggestion for you is duplicate pages in WordPress via plugins or functions.php file. Today, we would like to bring you detailed instructions about that. Let’s get started!

How to duplicate Pages in WordPress

Actually, there are two principal methods to duplicate pages in WordPress. The first one is to use WordPress Duplicator Plugins to do that. And another one is to add code to the functions.php file to generate duplicating pages or even duplicate posts.

However, we recommend that you should choose a plugin to accomplish your goals. Adding code to the theme file editor sometimes causes an error for your WordPress site and everything becomes complicated. So, it’s a good idea for you to get a safe solution.

Using plugins to duplicate Pages in WordPress

To be honest, on the current market, numerous handy plugins appear to help you duplicate pages in WordPress. However, we would like to introduce two easy-to-use and effective plugins: Yoast Duplicate Post and Duplicate Page and Post.

Now, let’s have a look at the detailed instruction to use Yoast Duplicate Post for your WordPress site.

  • Log in to your WordPress admin dashboard -> Go to Plugins -> Add New.
  • Find Yoast Duplicate Post -> Install and activate it.
  • On the admin dashboard, choose Open Page -> All Pages.
  • Select the page you want to duplicate, there will be 2 new options: Clone and New Draft.
  • If you hope to duplicate pages in WordPress, simply click on the Clone button. In case you need to generate a new page containing copied content, let’s choose the New Draft option.

Just Yoast Duplicate Post To Duplicate Pages In Wordpress

Another plugin to help you clone the current page is Duplicate Page and Post. Let’s follow the step below:

  • Log in to your WordPress admin dashboard -> Go to Plugins -> Add New.
  • Search Duplicate Page and Post -> Install and activate it.
  • Access¬†Open Page -> All Pages.
  • Click on the page you need to copy, the Duplicate option will appear for you to do that. After pressing on it, a new draft will be available for you to edit the content.

Use Duplicate Page And Post To Duplicate Pages In Wordpress

Using Functions.php File to duplicate Pages in WordPress

The second way to duplicate pages in WordPress is to insert the code into the Functions.php file. In order to do that, let’s open Appearance -> Theme File Editor -> Functions.php.

Duplicate Pages In Wordpress Via Functions.php

Now, it’s time for you to duplicate pages in WordPress by adding the following code snippet to the functions.php file:

* 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__ ) ) )

* 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);

* finally, redirect to the edit post screen for the new draft
wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
} 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'] = '<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('page_row_actions', 'rd_duplicate_post_link', 10, 2);

Wrap Up

In short, let’s save time in cloning the pages by following one of the two methods to duplicate pages in WordPress above. If you have any trouble related to topics, why don’t you leave your comment below so that we can support you?

Last but not least, don’t forget that our marketplace is offering numerous mobile-friendly and eye-catching Free WordPress Themes. So, don’t miss them if you need to get a new theme for your WordPress site!


We’re Digital Content Marketing team from AgeThemes Marketplace. We provide quality content for everyone who using open source CMS like Joomla and WordPress. If you have any questions or feedback, feel free leave your comment, we happy to assist you asap.

Leave a Reply

Your email address will not be published. Required fields are marked *

Summer Sale Enjoy your purchase with 50% OFF on today! code: SUMMER2024 More Details
Summer Sale Enjoy your purchase with 50% OFF on today! code: SUMMER2024 More Details