Deprecated: Return type of Ai1wm_Recursive_Directory_Iterator::rewind() should either be compatible with FilesystemIterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/Rocket-migration-tool/lib/vendor/servmask/iterator/class-ai1wm-recursive-directory-iterator.php on line 37

Deprecated: Return type of Ai1wm_Recursive_Directory_Iterator::next() should either be compatible with DirectoryIterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/Rocket-migration-tool/lib/vendor/servmask/iterator/class-ai1wm-recursive-directory-iterator.php on line 44

Deprecated: Return type of Ai1wm_Extension_Filter::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/Rocket-migration-tool/lib/vendor/servmask/filter/class-ai1wm-extension-filter.php on line 37

Deprecated: Return type of Ai1wm_Recursive_Exclude_Filter::getChildren() should either be compatible with RecursiveFilterIterator::getChildren(): ?RecursiveFilterIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/Rocket-migration-tool/lib/vendor/servmask/filter/class-ai1wm-recursive-exclude-filter.php on line 41

Deprecated: Return type of Ai1wm_Recursive_Exclude_Filter::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/Rocket-migration-tool/lib/vendor/servmask/filter/class-ai1wm-recursive-exclude-filter.php on line 37

Deprecated: Creation of dynamic property ThirstyAffiliates::$failed_dependencies is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/thirstyaffiliates.php on line 160

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_MAIN_PLUGIN_FILE_PATH is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 72

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_PLUGIN_DIR_PATH is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 73

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_PLUGIN_DIR_URL is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 74

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_PLUGIN_DIRNAME is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 75

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_PLUGIN_BASENAME is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 76

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_CSS_ROOT_URL is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 78

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_IMAGES_ROOT_URL is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 79

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_JS_ROOT_URL is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 80

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_VIEWS_ROOT_PATH is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 82

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_TEMPLATES_ROOT_PATH is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 83

Deprecated: Creation of dynamic property ThirstyAffiliates\Helpers\Plugin_Constants::$_LOGS_ROOT_PATH is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/thirstyaffiliates/Helpers/Plugin_Constants.php on line 84

Deprecated: Creation of dynamic property ElementorPro\Plugin::$updater is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementor-pro/plugin.php on line 494

Deprecated: Creation of dynamic property RankMathPro\Analytics\Email_Reports::$views_path is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/seo-by-rank-math-pro/includes/modules/analytics/class-email-reports.php on line 49

Deprecated: Creation of dynamic property RankMathPro\Analytics\Email_Reports::$assets_url is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/seo-by-rank-math-pro/includes/modules/analytics/class-email-reports.php on line 50

Deprecated: version_compare(): Passing null to parameter #2 ($version2) of type string is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementor/core/experiments/manager.php on line 167

Deprecated: Return type of ElementskitVendor\Google\Model::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Model.php on line 240

Deprecated: Return type of ElementskitVendor\Google\Model::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Model.php on line 244

Deprecated: Return type of ElementskitVendor\Google\Model::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Model.php on line 248

Deprecated: Return type of ElementskitVendor\Google\Model::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Model.php on line 257

Deprecated: Return type of ElementskitVendor\Google\Collection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Collection.php on line 19

Deprecated: Return type of ElementskitVendor\Google\Collection::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Collection.php on line 32

Deprecated: Return type of ElementskitVendor\Google\Collection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Collection.php on line 26

Deprecated: Return type of ElementskitVendor\Google\Collection::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Collection.php on line 36

Deprecated: Return type of ElementskitVendor\Google\Collection::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Collection.php on line 13

Deprecated: Return type of ElementskitVendor\Google\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/composer/vendor/build/vendor/src/google/apiclient/src/Collection.php on line 41

Deprecated: Creation of dynamic property ElementsKit\Libs\Updater\Edd_Warper::$beta is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/libs/updater/edd-warper.php on line 45

Deprecated: Creation of dynamic property Elementor\ElementsKit_Extend_Advanced_Tooltip::$url is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/elementskit/modules/advanced-tooltip/extend-controls.php on line 6

Deprecated: Creation of dynamic property SyntaxHighlighter::$brush_names is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter.php on line 248

Deprecated: Creation of dynamic property SyntaxHighlighter::$specialchars is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter.php on line 326
5 Way How to Duplicate WordPress Page or Post - WP Recommend
wprecommend logo

How to Duplicate WordPress Page or Post

5-ways-how-to-duplicate-wordpress-page-or-post

How to Duplicate WordPress Page or Post With and Without Plugins

Sometimes we want to take a backup of our currently working on WordPress post or page. And it’s a good habit when you are working on a really important project. Duplicate WordPress page or post with a single click can save you lots of effort and time.

Duplicate post or page allows you to take a backup of your existing work as a template, which you can use for future preferences. In this article, we will explain to you how to duplicate a WordPress page or post with and without plugins.

There are lots of ways to do clone a post or page in WordPress. We will cover all of them. Without any wasting time, let’s jump into it.

How To Duplicate Page or Post with WordPress Plugin

The easiest way to duplicate a WordPress page or post by using a plugin. There are lots of free plugins available at the WordPress plugin library. You just need to install and activate the plugin. After activation duplicating a page or post is a 1-click away.

Let’s take a look at which plugins can make this job easier for you. We will discuss the best WordPress plugin to duplicate posts or pages as well as how to use them shortly.

1. Duplicate Page Plugin

duplicate-wordpress-page-plugin

Duplicate page WordPress plugin is the best plugin we have ever used. You can duplicate WordPress page, post and custom post with a single click and it will save as your preferred options (draft, pending, private or public).

Duplicate Page Pro edition gives you more freedom like:

  • User Roles: You can give users permission to access Duplicate Page.
  • Clone Link Location: You can choose where to show the clone link.
  • Post Types: Filter to show Duplicate Page link in post types.
  • Status: Option to select Duplicate Posts Status.
  • Redirection: Option to Redirect after a click on the clone link.
  • Clone Link Title: Option to change Duplicate Post Link Title.
  • Post Prefix: Option to add Post Prefix.
  • Post Suffix: Option to add Post Suffix.
  • Editor: And a lot more features.

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

  1. First, install and activate the plugin.
  2. After activation select the duplicate page settings menu from the settings tab and do your desired changes.
  3. Now go to your WordPress dashboard then click on Post -> All Post (if you’re going to duplicate a post) or Pages -> All Pages (if you want to duplicate a page). 
  4. If you hover over the post or page which you want to clone, you will see a new option Duplicate This.
  5. Click ‘duplicate this’ button and you are done. You will see a new draft that can be opened using the post/page editor.

2. Duplicate Post Plugin

duplicate-post-wordpress-plugin

The powerful Duplicate post WordPress plugin allows you to duplicate not only content (post and pages), it also duplicates comments, menu orders, slugs, etc for future use.

Like duplicate page pro plugin, it allows you almost all freedoms. You can add prefix or suffix to the post and pages. So it became easier for you to remember which is a clone and which is original.

For example, you want to set ‘Clone Of’ as the title prefix for each clone post/page. Now if you duplicate a post named ‘What is SEO?’, the clone will be named “Clone of What is SEO?”.

To duplicate WordPress page or post using Duplicate Post plugin, follow these simple steps:

  1. Install and activate the duplicate post plugin.
  2. Go to ‘Edit Posts’/’Edit Pages’, then you can click on the ‘Clone’ link below the post/page title. This will automatically create a copy and save it as a draft.
  3. In the post edit screen, you can click on ‘Copy to a new draft’ above ‘cancel’/’Move to trash’.

For more help, you can refer to its documentation site: Duplicate post plugin documentation.

3. Post Duplicator WordPress Plugin

post-duplicator-wordpress-plugin

Post Duplicator plugin allows you to create an exact copy of posts or pages while it retains all custom taxonomies and custom fields as well. Custom post types are also supported.

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

  1. As always install and activate the plugin.
  2. Now hover over the post or the page you want to clone, and select ‘Duplicate {post_type}’ (Duplicate Post or Duplicate Page) to create a duplicate post.
  3. That’s it.

You can customize the plugin settings if you wish. Go to Tools > Post Duplicator and set the post status (draft, same as the original or published), post date and post type.

How To Duplicate WordPress Page or Post Without Plugins

Apart from using regular WordPress plugins, you also have a choice to make some tweak on coding to duplicate posts or pages. Coding geeks will love this method.

You just need to put the below code snippet to your functions.php file. Login to your Cpanel file manager, FTP or you can do it via inbuilt WordPress file manager.

We strongly recommend you to backup your website before editing any theme/plugin files.

Code snippet for duplicate WordPress post

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

Code snippet for duplicate WordPress post

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

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

Don’t have access to FTP or Cpanel? Don’t worry. Navigate to Appearance > Theme Editor, and select Theme Functions.

functions.php-edit

Now, if you have successfully added the code to your functions.php file, you should see a Duplicate button in All Posts or All Pages.

Conclusion

We hope in this tutorials we have covered up all tips & tricks on how to duplicate WordPress page or post with or without plugins. Let’s recap the summary:

With Plugins: You can duplicate or clone WordPress posts or pages easily. For this, you have so many plugins available like Duplicate Page, Duplicate Post or Post Duplicator plugin.

Without Plugins: If you are an expert at coding then you can try this. Just edit the function.php file with the above code and done.

Do you know any other way to do that? Share in the comment section so everybody can use that method too. Anyway if you have any questions you can ask at comment or contact us. Meanwhile, you can check out other tutorials.

Like it? Share with your friends!

Sanjay Samanta

Sanjay Samanta

I’m Sanjay Samanta the founder & CEO of Billions Ideas. I am a professional digital marketer who believes in done over perfect. I help people to make their brand and grow their business online by leveraging the power of strategic content marketing.

Leave a Comment

Sanjay Samanta
I’m Sanjay Samanta the founder & CEO of Billions Ideas. I am a professional digital marketer who believes in done over perfect. I help people to make their brand and grow their business online by leveraging the power of strategic content marketing.

Deprecated: Use of "parent" in callables is deprecated in /home2/sanjayhg/public_html/wprecommend.com/wp-content/plugins/wp-rocket/inc/Dependencies/Minify/JS.php on line 127