How to Duplicate WordPress Page or Post

How to Duplicate WordPress Page or Post

Creating a duplicate of your existing WordPress posts or pages can be useful in many situations. You can use the copy as a template for future posts, or a reference when you redesign your website.

Thankfully, there are multiple ways to clone a page or post in WordPress. This tutorial will explain those different methods, so sit tight and keep reading!

Everything you’ll need for WordPress hosting with up to 82% OFF!

Get Your Discount Here

Duplicating Page or Post with WordPress Plugin

The easiest way to create a copy of a page or post is by using a plugin. Upon activation, cloning posts and pages is only a click away!

Take a look at our selection of the best WordPress plugins to duplicate your posts and pages as well as how to use them:

1. Duplicate Post Plugin

Duplicate Post is a great plugin to clone a WordPress page or post.

Duplicate Post plugin is one of the go-to options for this purpose. Aside from copying the content, you can also duplicate the comments, slug, menu order, and much more!

In addition, the plugin allows you to add title prefix or a suffix, so you’ll know which one is the original and which one is the copy.

Let’s say you set “Copy of” as the title prefix. If you duplicate a post titled “What is WordPress,” the duplicate will be named “Copy of What is WordPress.”

To clone your WordPress posts or pages using Duplicate Post, follow these simple steps:

  1. Install and activate the plugin.
  2. Go to your WordPress dashboard, then click on Pages -> All Pages (if you want to clone a page) or Post -> All Post (if you’re going to clone a post).
  3. Hover over the page or post you want to clone, and you will see two new options there — Clone and New Draft.
    Duplicate Post plugin allows you to create a clone or new draft of your posts and pages.
  4. Click Clone to duplicate the selected post, or choose New Draft to create a cloned version of the chosen post and open it in the post editor.

2. Duplicate Page and Post

Duplicate Page and Post plugin helps you to clone your pages or posts

Duplicate Page and Post enables you to clone WordPress pages and posts quickly. The plugin can duplicate a page or post without changing its content, title, or style.

Using this plugin is relatively easy. You just need to follow these steps:

  1. After installing and activating the plugin, go to the All Pages or All Posts menu, depending on what you want to duplicate.
  2. Hover over the post or page you want to clone and click Duplicate.
    Click on "duplicate" to clone your a WordPress post or page.
  3. The cloned post or page will appear as a new draft with the same name as the original. Open the copy to edit the content.

3. Post Duplicator

Post Duplicator is an amazing WordPress plugin to clone your posts or pages.
Post Duplicator allows you to create an exact replica of the selected post while retaining the custom fields and custom taxonomies as well.

Here’s how to duplicate a WordPress page or post using Post Duplicator plugin:

  1. Install and activate the Post Duplicator plugin.
  2. Hover over the post or the page you want to duplicate, and click Duplicate Post or Duplicate Page.
    Click on "duplicate post" or "duplicate page" to create a new copy of a page or post.

There are some settings that you can customize for the duplicated posts. Go to Tools -> Post Duplicator and set the post status (draft, published, or same as the original), post type, and post date. It’s also possible to adjust the duplicate’s title and slug.

Duplicating WordPress Page or Post Without Plugins

Besides using plugins, you can also tweak some codes to duplicate WordPress pages and posts. While this method sounds like a bother, it is actually quite simple.

We strongly recommend to backup your website before editing any WordPress files.

The code snippet below will enable post duplication in WordPress:

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

This snippet only works for duplicating posts. You can duplicate WordPress pages by replacing the last line with this code:

add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);

All you need to do is paste the code to your functions.php file. To do this, you can either use File Manager, FTP client, or inbuilt WordPress file editor.

If you plan to use the third option, navigate to Appearance -> Theme Editor, and select Theme Functions.
You need to edit the functions.php file to clone a page or post manually.

Now, if you have successfully embedded the code above, you should see a Duplicate button in All Posts or All Pages menu.
The duplicate option will be available if you successfully edit the functions.php file.


We hope this tutorial answers all your questions about how to duplicate a post or page in WordPress. To refresh our minds, let’s have a quick recap.

First, you can duplicate a page or post using a WordPress plugin. For this purpose, there are three different plugins you can choose: Duplicate Post, Duplicate Page and Post, and Post Duplicator.

Second, you can do it without a plugin. All you need to do is access the functions.php file in WordPress, then enter the code that we’ve provided.

Do you have any questions, tips, or tricks? Let us know in the comment section below!

The Author


Domantas G. / @domantas

Domantas leads the content and SEO teams forward with fresh ideas and out of the box approaches. Armed with extensive SEO and marketing knowledge, he aims to spread the word of Hostinger to every corner of the world. During his free time, Domantas likes to hone his web development skills and travel to exotic places.

Related tutorials


Kirston Reply

October 24 2017

Hmm but anyway you use code, it is same like plugin right? I found one got no database settings, seems also fast, can you recommend??


Andrew Reply

November 06 2017

Hi, good good tutorial. Is possibile create duplicated post into other database? I have two wordpress, with two different database . Fist wordpress is for staging, second is for production. This solution is very useful to create a new post in staging and create it in production env. Thanks.


Emanuele Reply

March 16 2018

Works fine but only for post or page, i have done a simple plugin to create custom post...where ve i to change? Thx


    Domantas G.

    Replied on March 23 2018

    Hi Emanuele, What exactly do yo want to duplicate?


Suresh Mothsara Reply

April 28 2018

Good tutorial for copy page because sometime it need to clone same layout from one page to another and it will very helpful for it and also able to copy page layout via making it duplicate thanks for informative article


HB Reply

September 09 2018

Thank you for the php code. Worked a treat!


Victor Reply

October 17 2018

Thank you. Great piece of code. :)



    Replied on July 03 2019

    Thank You this code is great and I have been using it for quite some time. I would like to add one minor change since Gutenberg and advanced custom fields threw a wrench into it. Simply wrapping addslashes() around $post->post_content will fix any issues that occur.


      Domantas G.

      Replied on September 24 2019

      Hey Doug, Thanks for a great tip!


kushinauwu Reply

February 11 2019

Thank you so much for this! The code works like a charm! Nicely explained, great options for people who'd want to go the plugin way as well.


Chris Reply

June 02 2019

Thanks for the great post. Has anyone written a script for cloning a hierarchy of pages? So it would clone all nested children in addition to the parent page?


Rostislav Sofronov Reply

September 03 2019

Hello Plugin WPBE - WordPress Posts Bulk Editor Professional has duplication functionality for all post types, and its possible duplicate not only for one time the same post but for many times


bibah Reply

October 16 2019

Thank you. Great piece of code. 🙂


Adrina_Lima Reply

December 30 2019

Its really needed post and I found it on your site, I think you are very co operative to your customer. Thanks again.



    Replied on January 29 2020

    Hey Adrina, Happy to hear that it helped.


WordPress Lover Reply

January 08 2020

Thanks for the great post. There's a lot of nice information. Also, I want to mention another nice plugin for duplicating posts/pages -


Jonny Reply

February 06 2020

Worked like a charm. I copied your code snippet into my child theme's functions, changed it to work for pages and wham! Thank you :)


Marcio Reply

February 17 2020

Hey man, your code is better than any duplicating plugins. Congratulations!


Mehdi Salehi Reply

August 03 2020

Hi, Thank you so much. worked :)

Author Reply

August 04 2020

Besides using plugins, you can also tweak some codes to duplicate WordPress pages and posts. While this method sounds like a bother, it is actually quite simple.


Alain LOYENS (Brussels / Belgium / EUR) Reply

August 18 2020

I'm far from being a geek. I'm in the IT since 1978... (70). Retired and UML2 teacher. I tried to include the snippet code into functions.php but it has apparently no effect. Could I mail to you 3 screen copies to find out what I missed ? Anyway many tks in advance. (Can you send me a mail address pls?)


    Tomislav T.

    Replied on November 06 2020

    Hey there Alain! Of course you can email us the screen cap copies. Just login to your Hostinger account and you can reach our Customer Success team that works 24/7! :)


Daniel Reply

September 16 2020

Thanks for this! I tried putting this into my functions.php file, but the Duplicate link is not showing up on my posts as it is in your example. Do you know if this works with the latest WP versions?


    Tomislav T.

    Replied on November 18 2020

    Hey Daniel. It should work with all the WP versions, yes. Make sure you put it within the frames of the functions.php, and you aren't out of the last closed bracket of the code. If you still struggle, just drop a line to our Customer Success team and we will help you out! :)


PuckStar Reply

November 08 2020

Thanks for the code. Works flawless!


Mila Reply

December 07 2020

Nice! It worked :) Now, I want to be able to duplicate both: pages and posts. What should I do? Thanks!



    Replied on February 09 2021

    Hi, Mila! If you use the second plugin (Duplicate Page and Post), that should allow you to duplicate both your pages and posts :)

Leave a reply




This site uses Akismet to reduce spam. Learn how your comment data is processed.

Become a part of Hostinger now!

More in WordPress
How to Defer Parsing of JavaScript in WordPress