How to duplicate a page in WordPress

Have you ever faced a situation where you want to freshen up your current page with a new design, but want to keep the content intact for future use? Sure you can use copy/paste and save all content to a draft, but this would not move SEO optimization, page templates, featured images and other associated data.

There are also times when you want to clone your existing blog/page just to make some adjustments to one of the copies and compare it to the old version. Well, there could be plenty of circumstances when you just need to duplicate a page or post in !

It is useless to have to do it twice when you can really save your time by simply duplicating the desired page or post in WordPress with one click. In this tutorial, we will learn how to duplicate a page in WordPress with the help of plugins as it is the easiest and simplest way to do it.

So let’s get started.

what you will need

Before starting this guide, you will need the following:

  • Access to the WordPress Administration Panel

Option 1 – Duplicate a page/post with the Duplicate Post plugin

The Duplicate Post plugin is one of the easiest ways with which you can clone your page or post in WordPress. Not only does it allow you to create a clone, but you can also choose to add your own customization options. You can have a predefined suffix or prefix that can be added before or after the page title or cloned post. Additionally, you can also restrict the functionality of the plugin based on user roles.

To clone your post/page with this plugin, follow the steps below:

  1. the plugin.
  1. then click Pages -> All Pages.
  2. Now hover over the page or post you want to clone, and you’ll see two new options there: Clone Y New draft.
  • you can click Clone to create a clone version of the selected entry.
  • you can click new draft to create a clone version of the selected entry and open it in the entry editor. You can then start editing and choose to save it as a draft or publish it.
See also  The 8 Best Plugins for Your WordPress Online Store in 2022

Option 2 – Clone a page/post with the Duplicate Page and Post plugin

Duplicate Page and Post is another plugin that can be used to quickly clone pages and posts. The plugin helps you create a duplicate of a page or post while making sure that all the content, title and style of the page or post are preserved as it is.

Using this plugin is quite easy. You just have to follow these steps:

  1. the Duplicate Page and Post plugin.
  1. Then go to Pages -> All Pages if you want to create a cloned copy of a page, or to Posts-> All Posts if you want to create a cloned copy of your entry.
  2. Hover over the entry you want to clone and click Clone Me!.
  3. You will then be redirected to a cloned copy of the post or page, respectively. Edit it and click Post (Publish) or in Save draft (Save Draft).

Option 3 – Use Post Duplicator to clone WordPress posts and pages

If the above two plugins do not suit your needs very well, you can choose to use Post Duplicator. This plugin would allow you to create an exact replica of the selected post while preserving custom fields and custom taxonomies.

This is all you have to do is:

  1. .
  2. Hover over the post or page you want to duplicate and click Duplicate Post/Duplicate Page to create a clone copy.
  3. The plugin will instantly duplicate the page or post.

Option 4 – Duplicate a WordPress page or post without using plugins

Apart from using plugins, you can also use code to duplicate WordPress pages and posts. All you have to do is paste this code into your file functions.php. To do this, you can use the built-in WordPress File Manager, File Manager, or File Editor.

If you opt for the second option, read our article to learn about editing code.

On the other hand, if you want to use a built-in file editor to duplicate posts or pages on your site, navigate to Appearance in your WordPress dashboard. Go to and select Theme Features.

See also  is listed as web hosting provider no. 1 in 2021

Alternatively, you can use the file manager from to configure the file functions.php.

Now, let’s see the step-by-step instructions to duplicate a page or post on your WordPress website.

How to duplicate an entry via functions.php file

To duplicate a post, you’ll need to paste the following code snippet into your 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) || isset( $_POST) || ( isset($_REQUEST) && ‘rd_duplicate_post_as_draft’ == $_REQUEST ) ) ) { wp_die(‘No post to duplicate has been supplied!’); } /* * Nonce verification */ if ( !isset( $_GET ) || !wp_verify_nonce( $_GET, basename( __FILE__ ) ) ) return; /* * get the original post id */ $post_id = (isset($_GET) ? absint( $_GET ) : absint( $_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 = ‘ID, basename(__FILE__), “duplicate_nonce’ ) . ‘” title=”Duplicate this item” rel=”permalink”>Duplicate‘; } return $actions; } add_filter( ‘post_row_actions’, ‘rd_duplicate_post_link’, 10, 2 );

See also  The best HTML editors of 2022

How to duplicate a page in WordPress via the Functions.php file

The process to duplicate a page in WordPress is quite simple. All you have to do is replace the last line of the code above with the following snippet:

add_filter(‘page_row_actions’, ‘rd_duplicate_post_link’, 10, 2);

Now if you go to the section All entries either All pagesyou should see a button Double.

If you press this button, WordPress will create a copy of the page or post and save it as a draft.

conclusion

We are sure that you must be wondering why you didn’t know about these plugins before. Better late than never! We hope the above tutorial answered all your questions and now you know how to duplicate a page in WordPress. All the plugins mentioned above are not only fast but also reliable. Why waste your time on a task when you can actually do it with just a few clicks?

Do you have any questions or do you have an experience to share? Tell us in the comments!

For more WordPress guides and tutorials, be sure to check out the .

Gustavo is passionate about creating websites. He focuses on the application of SEO strategies at for Spain and Latin America, as well as the creation of high-level content. When he is not applying new WordPress tricks you can find him playing the guitar, traveling or taking an online course.

Loading Facebook Comments ...
Loading Disqus Comments ...