How To Create WordPress Duplicate Page Or Post With A Single Click

Sometimes we need to create a duplicate page or post or duplicate product page or maybe a duplicate sales email copy to use the template and existing setting of the page. If you are using WordPress then in WP you can easily duplicate any page or post. I will help you how to create a WordPress duplicate page or post with a single click only.

You may create the duplicate page manually and if you don’t know how to create a WordPress duplicate page then after reading this post you can create a duplicate copy easily. I will show you not one way, I will guide you to create duplicate copy manually and using plugin also.

How To Create WordPress Duplicate Page Or Post With Single Click

One more important thing is that by using this method you can duplicate your page setting, total page content, code including an image. So it will save you lots of time.

Why You Need To Create Duplicate Page Or Post

Before learning how to create a WordPress duplicate page you should read why need to create a duplicate copy and what are the benefits of it?

If you running a WordPress blog then sometimes you need to create a duplicate page to update content or update your old post. Let’s think about your sales page? You know a sales page contain lot’s of setting, lot’s of content so when you manually create a duplicate copy then you can not duplicate your pages SEO setting, can’t duplicate image then you have to invest a lot’s time to create a duplicate copy.

By using the duplicate method you can duplicate all settings, SEO settings, images, and all content and this will save a lot’s time.

How To Create WordPress Duplicate Page Or Post

You can create WordPress duplicate page or post by two methods. The first method is installing WordPress plugins and the second method is by insert some code to your website. So, first we discuss how to duplicate by using WordPress plugin.

Here is a details video guide by WPbeginner on how to create WordPress duplicate page you can watch below to understand better.

how to create WordPress duplicate page

There are some WordPress plugin is available by which you can easily duplicate content. But before that you have to install WordPress plugin. If you don’t know how to install WordPress plugins then you can check our guide on how to manually install WordPress Plugins.

1. Yoast Duplicate Post

Yoast duplicate post plugin is one of the best WordPress plugins that may help you to create duplicate posts or pages with a single click. These plugins not only copy the content but also copy comment, menu order, setting, SEO setting, and much more and save lots of time.

How To Create WordPress Duplicate Page Or Post With Yoast Duplicate Pot Plugins
How To Create WordPress Duplicate Page Or Post With Yoast Duplicate Pot Plugins

To work with you have to install the duplicate post plugin firt and then just active the plugin from the WordPress admin dashboard panel.

After activating the plugin just go to the all post page to see what changes come to the posting page. You can see two new options comes. One is a cloned post and another is to create a new draft post.

How to create WordPress duplicate page

If you simply click on the clone option then a new duplicate post will be created but you can not edit that post but if you click on the new draft options then a new duplicate post will create and saved in the draft wich you can easily edit from dashboard.

The plugin also work on lading pages, sales page copy, any pages and many more.

Customize The Yoast Duplicate Post Page Setting

The Yoast duplicate post plugin works nice on any post or page options and you can customize the plugin setting for more advanced work.

You can also customize the plugin to enable the custom post page settings, restrict user role on-page settings, and more options available. Just you have to choose the What to copy options when creating a duplicate post or page.

To open the setting just go to the plugin setting then go to the duplicate post options then you can see the page like below

How To Create WordPress Duplicate Page Or Post
How To Create WordPress Duplicate Page Or Post

The setting page is divided into the three-tab, The first tab is what to copy options which are very useful and you can select what will be copied when creating a new post. You can select or de-select any options according to your needs.

You can give title prefix and title suffix for creating a duplicate post or page. If you give Copy at the prefix then when a new duplicate post creates then the title prefix will be copy and the suffix will be the same.

How To Create WordPress Duplicate Page Or Post
How To Create WordPress Duplicate Page Or Post

The next options or tab is permission tab in this options you can give permission who can create a duplicate post or duplicate page or create any duplicate things. The default options is for administrator and editor and if you want to give permission for author or manager then you can tick the field.

What they can duplicate here default options is post and page and if you want to give permission for blocks also then just tick the block field.

How To Create WordPress Duplicate Page Or Post
How To Create WordPress Duplicate Page Or Post

The last options is display option where the clone or duplicate pot options comes. The default options is post item, edit screen, admin bar and bulk options. You can select according to your needs.

At the last don’t forget to save the plugin setting. This plugin is very helpful and save lot of time.

There are many plugin also availabe to do the same work. I list some of the another plugin also. If you don’t want to use this one then you can choose from the below options.

Duplicate Page And Post

The second plugin which also very useful to create a duplicate post or duplicate post is Duplicate Page And Post Plugin. This plugin is a very lightweight plugin and doesn’t slow your server speed and doesn’t slow your website. By using this plugin you can easily create a clone of any post or page.

How To Create WordPress Duplicate Page Or Post with Duplicate Page And Post Plugin
How To Create WordPress Duplicate Page Or Post with Duplicate Page And Post Plugin

After install the plugin you have to activate the plugin first and after activating the plugins you can see the clone options of your post or pages. I include some screenshot by which you can get a clear idea how and where you can create and duplicate your post and page.

How To Create WordPress Duplicate Page
How To Create WordPress Duplicate Page

This screenshot show how you can create a clone of any page with just ingle click only.

How To Create A Duplicate page and post with just a single click
How To Create A WordPress Duplicate page and post with just a single click

Now let’s talk about the plugin setting options that means what you can create and clone and what options you get when you create a copy of your post.

The plugin setting of creating WordPress duplicate post
The plugin setting of creating WordPress duplicate Page

Here you can see the four setting options the first one is editor options that means after create a post or page what editor you prefer to edit the clone post. The second options is clone post will be draft mode if you want to select the publish mode then same post will be published. You can add prefix of your post.

Duplicate Page Plugin

Another plugin that you can see in the WordPress plugin directory is Duplicate Page Plugin which will help you to create duplicate copy and clone any page or post.

How to create a WordPress duplicate page with duplicate page plugin
How to create a WordPress duplicate page with duplicate page plugin

To use the plugin just install the plugin from your WordPress admin dashboard panel and then active the plugin first. now look what you can do with the plugin?

You can create a duplicate page, duplicate any post, duplicate any block, duplicate any sales page copy and many things. Just look at the setting of the plugin to understand what you can do with it.

Post Duplicator Plugin

Post Duplicator plugin is another very good WordPress plugin that may help you to create a duplicate copy of any post. You can create a duplicate copy of your post with a single click.

How to create a WordPress duplicate post
How to create a WordPress duplicate post

To work with the plugin just install the plugin and then activate the plugin first. After activating the plugin just go to the post options to duplicate any post.

How To Create WordPress Duplicate page and Post
How To Create WordPress Duplicate page and Post

To create a WordPress duplicate page just go to the pages from your WordPress admin dashboard and hover the mouse on the particular page to create a duplicate copy.

How To Create WordPress Duplicate Page Or Post Without Plugin

If you don’t want to use any WordPress plugin to create WordPress duplicate page or post then you can use code to do the same functions.

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

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

The source of the code is Hotinger blog

This code snippet only works for duplicate post options and by using this code you can duplicate any post from your WordPress post options.

If you want to duplicate page options then just replace the last line code with the code below.

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

Remember that you have to paste the code in the functions.php file. You can edit the functions.php file by using a file manager or FTP client.

There are another options is you can use theme functions to paste your code. To paste the code on the theme function you have to go to theme editor options then go to the theme functions and then paste the code.

The Final Word

In this post I write how to create a WordPress duplicate page or post using WordPress plugin and if you don’t want to use WordPress plugin then you can use the custom code to create duplicate post with a single mouse click.

I hope you understand how to do it and it will save your lot’s of time. Do you have any questions then feel free to ask me and you can also comment your opinion in the comment box.

  •  
    74
    Shares
  • 27
  • 9
  • 30
  •  
  • 8

Leave a Comment

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