Duplicate a Page or Post in WordPress
You may find yourself in a position where you need to create a new post or page that is similar (or nearly identical) to one that already exists on your site.
If the post or page is lengthy or contains a lot of material, the process of re-entering all of that information might be time-consuming. Also, if you have a lot of posts that are quite similar to one another, having to manually type out all of your text or upload all of the media files to make new posts or pages will be extremely inconvenient.
One approach is to view the old post in one browser window or tab (for convenience, we’ll refer to posts and pages as “posts” below), then make your new post in another window and transition between the two, copying and pasting your information. After all, modern (post-Gutenberg) versions of WordPress make this rather simple, with a “Copy all content” option.
However, if you have to do this often, you run the danger of making mistakes. What if you make a mistake and update the original post, causing the content you’ve previously published on your site to be overwritten? Or if you have a lot of posts to copy and you can’t remember which ones you’ve made?
It has the potential to be a headache.
How to Duplicate a Page or Post in WordPress, the Semi-Manual Way
Using a Plugin, duplicate a page or post in WordPress
How to Duplicate Multiple Posts or Pages at Once
Make Your Own Duplicate Post Plugin
There is, thankfully, an easier way. There are free plugins that allow you to replicate your posts and pages so that you can change and tweak them to create new posts that are nearly identical to your old ones.
How to Duplicate a WordPress Page or Post:
Using one of the following plugins, you may effortlessly replicate pages, posts, and custom post kinds in WordPress:
Duplicate Posts: In the WordPress admin, it adds a “Clone” link to each post/page.
The Duplicate Page plugin adds a “Duplicate This” link to the bottom of each post, page, or custom post type.
WP Bulk Post Duplicator: This plugin lets you duplicate several posts/pages at once.
If you’re using WooCommerce and need to duplicate a product, hover your mouse over it and a Duplicate link will appear beneath it.
Support
In this article, we’ll go through some of the strategies you may use to accomplish this, as well as some of the best plugins for the job.
But first, we’ll show you how to replicate a page or post in WordPress without using a plugin in a semi-manual manner. This requires copying and pasting, but WordPress makes it so simple that if you only have one post to copy, it’ll be faster than installing a plugin and doing it that way.
Do you need to make a lot of similar posts/pages that aren’t exactly the same? 🐴🦄 Don’t waste time starting from the beginning. Duplicate all of them!
TO TWEET, CLICK HERE
The Semi-Manual Way to Duplicate a Page or Post in WordPress
If you only need to duplicate one article, this method can save you time by not requiring you to install a plugin. If you have a lot of posts to replicate, I’d recommend bypassing this phase and instead using a plugin, which will be considerably faster and more precise.
Here’s how to duplicate a single post or page for those of you who only need it once.
To begin, go to your existing post or page and open it. By clicking outside a block on your post or selecting the Document tab in the editing window to the right of the screen, make sure you don’t have an individual block selected. If you choose a block, WordPress will just replicate that block’s contents, not the entire document.
Now, at the upper right of the editing screen, click the ellipsis (three dots arranged on top of each other).
WordPress’s ability to copy all content
There will be a menu. You’ll see a Copy All Content option near the bottom of this menu. When you click it, you’ll see a notice that your content has been duplicated.
Create a new post now. Give your post a title, then click in the first empty block on the editing page that has been created for you. Use your keyboard’s shortcut keys to paste (Ctrl + V on a PC, Cmd + V on a Mac), or right-click and pick Paste from the shortcut menu that appears.
Your previous post’s content will now be displayed in your new one. Magic! (Perhaps not.)
You may now update that post to make it unique from the previous one. This is something I strongly encourage you to do because having blog entries that are identical clones of each other on your site is pointless. It will not only confuse visitors, but it will also harm your SEO.
But what if you want to reproduce your article numerous times? Continue reading…
How to Duplicate a Page or Post in WordPress using a Plugin
Using a plugin is by far the quickest, easiest, and most reliable way to duplicate a Page or posts. This will save you time, eliminate human error, and enable you to clone any Page or post type. In fact, we’ve found that duplicate postings are more likely with custom post kinds. It’s odd to have two blog entries that are nearly identical, yet it happens all the time with store products, for example.
So, here are some plugins that will make duplicating posts a breeze, as well as instructions on how to utilize them.
WooCommerce
You might be questioning why I included WooCommerce in this list when it’s an ecommerce plugin rather than a post-duplication plugin.
However, it’s worth noting that WooCommerce allows you to duplicate products without the need for a separate plugin. So, before you go looking for a post-duplication plugin to employ to duplicate your products, take advantage of WooCommerce’s built-in functionality.
If you go to WooCommerce’s main Products screen and hover your mouse over any product, a Duplicate link will appear under that article.
Duplicate product option in WooCommerce
Simply click on the Duplicate link to generate a new product. You’ll be transported immediately to the new product’s editing screen, where you may make adjustments and then publish it.
It’s worth noting that the slug for the new product will be the slug for the old product with -copy added, so you’ll need to alter the slug even if you change the new product’s title.
Editing a product that has been copied
With over 3 million downloads, the Duplicate Post plugin is the most popular plugin for duplicating posts.
When you enable it, it adds a Clone link to each post in the WordPress admin’s main Posts panel.
Duplicate Posts is a plugin that allows you to find duplicate posts on your site.
When you click the Clone link under the post you wish to duplicate, a new post with the same content and title will be created for you, with a Draft status.
You can then edit that new post and give it a new title (which I strongly suggest you to do – WordPress does allow you to duplicate titles, but it’s not ideal for user experience).
The Clone link is also added to pages and custom post types (if you enable them in the settings).
Page that has been duplicated
The Duplicate Page plugin, which is similar to the Duplicate Post plugin above, has over 900,000 downloads.
After you’ve installed the plugin, go to the Posts or Pages admin panel, or the admin screen for your custom post type, and under each post, you’ll see a Duplicate This link. Here’s mine, complete with a unique post type:
Duplicate Page is a plugin that allows you to create duplicate pages.
When you click the link, a new post (or page, or post of your custom post type) will appear, with the same content and title as the original post and the status of Draft. Before you post it, you’ll need to update it and change the slug.
Note that if you use WooCommerce, the Duplicate This link from this plugin will not appear on your Products page. WooCommerce overrides it with its own Duplicate link, as I previously mentioned in this post.
How to Duplicate Posts or Pages in Bulk
Duplicating posts one at a time is possible using the plugins I’ve already discussed. But what if you need to copy all of your site’s posts or all of a custom post type’s posts? Or perhaps all of the posts you’ve written this year?
Do you want to discover how we grew our traffic by over 1000%?
Join the 20,000+ people who receive our weekly email with WordPress insider secrets!
Now is the time to subscribe.
This is exactly what the WP Bulk Post Duplicator plugin will allow you to do. Rather than providing a link to replicate individual posts, it provides a settings panel that allows you to duplicate posts in bulk based on your criteria.
Note: This plugin hasn’t been updated in over two years, therefore we recommend installing it on a test site and testing it before using it on a live site. We had no issues with it on our testing site.
After you’ve installed the plugin, navigate to Settings > WP Bulk Post Duplicator to access the plugin’s settings page.
Begin by selecting the post kinds and statuses that you want to duplicate. As a result, if you choose to post and publish, the plugin will replicate all of your already published posts. If you choose posts and draft instead, it will simply replicate all of your draft posts.
Duplicate Post Type and Status – Bulk Duplicate Settings
Select the year of the posts you want to replicate by scrolling down (this is optional). The status of the newly produced posts can then be specified. If you leave this field blank, it will default to Draft.
Year and publish status for bulk duplicate settings
The plugin will replicate your posts if you click the Duplicate button. All of my pages have been duplicated, with 12 previously published pages and 12 fresh draft pages. After that, I’ll have to go over all of the pages and edit them before publishing them. That will certainly take time, but the mass duplication has made it go faster.
Write Your Own Post Duplication Plugin
What if you don’t want to utilize a third-party plugin and instead prefer to code your own duplicate posts?
It’s no problem. To make your own post duplication plugin, simply follow these steps.
1. Installing The Plugin
Begin by installing the plugin. Add this commented out text to a new file in your wp-content/plugins folder (you can alter it to reflect your author name):
Kinsta Duplicate Posts and Pages Plugin
URI of the plugin:
Plugin to go along with kinsta posst for duplicating posts in WordPress. Allows posts and pages to be duplicated.
Version number: 1.0
Rachel McCollin is the author of this piece.
URI for the author:
kinsta is the text domain.
*/ 2. Creating the Function License: GPLv2
Now connect the code for replicating posts to an action hook. This action hook does not yet exist; don’t worry, we’ll create it as soon as possible.
add action(‘admin action kinsta duplicate post’, ‘kinsta duplicate post’); function kinsta duplicate post();
Now we’ll make that action, which will be part of a function that will add the duplication link to the posts and pages screens.
Are you fed up with slow WordPress hosting and unresponsive customer service? We’re obsessed with speed and have real WordPress experts available to help you 24 hours a day, seven days a week. Take a look at our plans.
if (current user can(‘edit posts’)) kinsta duplicate post link($actions, $post) ‘Duplicate’; $actions[‘duplicate’] = ‘Duplicate’;
$actions should be returned;
add filter(‘post row actions’, ‘kinsta duplicate post link’, 10, 2); add filter(‘page row actions’, ‘kinsta duplicate post link’, 10, 2); add filter(‘post row actions’, ‘kinsta duplicate post link’, 10, 2);
This will add the duplication link, but it will not duplicate anything yet.
3. Adding Duplication Capabilities
Let’s add the duplication code now. The rest of the code goes within your kinsta duplicate post() function, which is now empty.
To ensure security, we’ll first verify that a genuine post has been chosen and look for a nonce:
$wpdb is a global variable.
If (! (isset($ GET[‘post’]) || isset($ POST[‘post’]) || (isset($ REQUEST[‘action’]) || (isset($ POST[‘post’]) || (isset($ REQUEST[‘action’]) || (isset($ REQUEST[‘action’]) || (isset($ REQUEST[‘action’ && ‘kinsta duplicate post’ == $ REQUEST[‘action’])) wp die( (‘Please select a post to duplicate.’, ‘kinsta’)); wp die( (‘Please select a post to duplicate.’, ‘kinsta’)); wp die( (‘Please select a post to duplicate.’, ‘kinsta’)); wp
/ Check the nonce
if (! isset($ GET[‘duplicate nonce’]) ||! wp verify nonce($ GET[‘duplicate nonce’], basename( FILE )) return; if (! isset($ GET[‘duplicate nonce’], basename( FILE )) return; if (! isset($ GET[‘duplicate nonce’
Now we need to get the ID of the copied post as well as its data:
/ Get the id of the duplicated post as well as the data from it.
(isset($ GET[‘post’]) $post id = (isset($ GET[‘post’]) $post id = (isset($ GET[‘post’ $post = get post($post id); absint($ GET[‘post’]): absint($ POST[‘post’])
Using wp insert post, we can define an array of arguments and insert a new post into the database (), But first, make sure the post isn’t null with a conditional statement:
If (isset($post) && $post!= null) is true, then
Include the following inside the conditional statement:
/ parameters for a new post
$args = array(‘comment status’ => ‘comment status’) ‘ping status’ => $post->comment status, ‘comment status’ => ‘post author’ => $post->ping status ‘post content’ => $post->post author ‘post excerpt’ => $post->post content ‘post name’ => $post->post excerpt, ‘post excerpt’ => ‘post parent’ => $post->post name ‘post password’ => $post->post parent ‘post status’ => $post->post password ‘draft’, ‘post title’ => ‘draft’, ‘post title’ => ‘post type’ => $post->post title, ‘post title’ => ‘to ping’ => $post->post type, ‘to ping’ => ‘menu order’ => $post->to ping $post->menu order \s);
/ create a new post
wp insert post($args); $new post id = wp insert post($args);
Now we’ll import the taxonomies from the previous post into the new one:
/ to the new post, add taxonomic terms
$taxonomies = get object taxonomies($post->post type); / find taxonomies that apply to the post type $taxonomies = get object taxonomies($post->post type);
$post terms = wp get object terms($post id, $taxonomy, array(‘fields’ =>’slugs’)); wp set object terms($new post id, $post terms, $taxonomy, false); wp set object terms($new post id, $post terms, $taxonomy, false); w
Then, using a SQL query, we’ll add any additional post metadata:
To duplicate postmeta, use SQL queries.
$post metas = $wpdb->get results(“SELECT meta key, meta value FROM $wpdb->postmeta WHERE post id=$post id”); if (count($post metas)!=0), $wpdb->get results(“SELECT meta key, meta value FROM $wpdb->postmeta WHERE post id {
“INSERT INTO $wpdb->postmeta (post id, meta key, meta value) “; $sql query = “INSERT INTO $wpdb->postmeta (post id, meta key, meta value) “;
$post metas as $post meta) foreach if($meta key == ‘_wp old slug’) continue; if($meta key == ‘_wp old slug’) continue;
$meta value = addslashes($post metas->meta value); $sql query sel[]= “SELECT $new post id, ‘$meta key,’$meta value'”; $sql query sel[]= “SELECT $new post id, ‘$meta key,’$meta value'”
$wpdb->query($sql query); $sql query.= implode(” UNION ALL “, $sql query sel);
}
Finally, we determine the post’s post type and redirect to the appropriate panel.
Depending on the post type, you’ll be redirected to the admin panel.
wp redirect(admin url(‘edit.php?post type=’. $posttype)); get post type($post id); get post type($post id); get post type($post id); get post type($post id); get post type($post id); get post type($post_
We now add an error message outside the braces for the if (isset($post) && $post!= null) check:
else / show a message if there’s a problem if the post id of the duplicated post cannot be retrieved
wp die( (‘The post you’re looking for isn’t there. Please choose a duplicate post.’, ‘kinsta’));
That’s all there is to it!
The Complete Plugin
The plugin’s complete code may be found here:
<?php
/* Kinsta Duplicate Posts and Pages Plugin
URI of the plugin: https://kinsta.com
Plugin to go along with kinsta posst for duplicating posts in WordPress. Allows posts and pages to be duplicated. Version number: 1.0 Rachel McCollin is the author of this piece.
URI for the author: https://rachelmccollin.com
kinsta is the text domain.
kinsta duplicate post() is a function that checks for duplicate posts.
$wpdb is a global variable.
(isset($ GET[‘post’]) || isset($ POST[‘post’]) || (isset($ REQUEST[‘action’]) && ‘kinsta duplicate post’ == $_REQUEST[‘action’])) {
wp die( (‘Please select a post to replicate.’, ‘kinsta’)); wp die( (‘Please select a post to duplicate.’, ‘kinsta’)); wp die( (‘Please
/ Check the nonce
if (! isset(‘duplicate nonce’]) ||! wp verify nonce)
return; ($ GET[‘duplicate nonce’], basename( FILE ))
/ Get the id of the duplicated post as well as the data from it.
(isset($ GET[‘post’]) $post id = (isset($ GET[‘post’]) $post id = (isset($ GET[‘post’ $post = get post($post id); absint($ GET[‘post’]): absint($ POST[‘post’])
If (isset($post) && $post!= null), the post will be duplicated. {
/ parameters for a new post
$args = array(‘comment status’ => ‘comment status’) ‘ping status’ => $post->comment status, ‘comment status’ => ‘post author’ => $post->ping status ‘post content’ => $post->post author ‘post excerpt’ => $post->post content ‘post name’ => $post->post excerpt, ‘post excerpt’ => ‘post parent’ => $post->post name ‘post password’ => $post->post parent ‘post status’ => $post->post password ‘draft’, ‘post title’ => ‘draft’, ‘post title’ => ‘post type’ => $post->post title, ‘post title’ => ‘to ping’ => $post->post type, ‘to ping’ => ‘menu order’ => $post->to ping $post->menu order \s);
/ create a new post
wp insert post($args); $new post id = wp insert post($args);
/ to the new post, add taxonomic terms
$taxonomies = get object taxonomies($post->post type); / find taxonomies that apply to the post type $taxonomies = get object taxonomies($post->post type);
$taxonomies as $taxonomy) / add the taxonomy terms to the new post foreach
$post terms = wp get object terms($post id, $taxonomy, array(‘fields’ =>’slugs’)); wp set object terms($new post id, $post terms, $taxonomy, false); wp get object terms($post id, $taxonomy, array(‘fields’ =>’slug
}
To duplicate postmeta, use SQL queries.
$wpdb->get results(“SELECT meta key, meta value FROM $wpdb->postmeta WHERE post id=$post id”); $post metas = $wpdb->get results(“SELECT meta key, meta value FROM $wpdb->postmeta WHERE post id=$post id”);
if ($post metas)!=0)
“INSERT INTO $wpdb->postmeta (post id, meta key, meta value) “; $sql query = “INSERT INTO $wpdb->postmeta (post id, meta key, meta value) “;
$post metas as $post meta) foreach
$meta key = $post metas->meta key; continue if ($meta key == ‘_wp old slug’); $meta value = addslashes($post metas->meta value); $sql query sel[]= “SELECT $new post id, ‘$meta key,’$meta value'”;
}
$wpdb->query($sql query); $sql query.= implode(” UNION ALL “, $sql query sel);
}
Depending on the post type, you’ll be redirected to the admin panel.
wp redirect(admin url(‘edit.php?post type=’. $posttype)); get post type($post id); get post type($post id); get post type($post id); get post type($post id); get post type($post id); get post type($post_
otherwise
/ a message with an error if the post id of the duplicated post cannot be retrieved
wp die( (‘The post you’re looking for isn’t there. Please choose a duplicate post.’, ‘kinsta’));
‘admin action kinsta duplicate post’, ‘kinsta duplicate post’); add action(‘admin action kinsta duplicate post’, ‘kinsta duplicate post’);
kinsta duplicate post link($actions, $post) kinsta duplicate post link($actions, $post) kinsta duplicate post link($actions, $post) kinsta duplicate post link($actions, $post) kinsta d
(current user can(‘edit posts’)) if (current user can(‘edit posts’)) ‘Duplicate’; $actions[‘duplicate’] = ‘Duplicate’;
$actions should be returned;
add filter(‘post row actions’, ‘kinsta duplicate post link’, 10, 2); add filter(‘page row actions’, ‘kinsta duplicate post link’, 10, 2); add filter(‘post row actions’, ‘kinsta duplicate post link’, 10, 2);
The complete plugin is also available on github.
Congratulations! You now have your own WordPress plugin for duplicating posts and pages.
Credit: Parts of this code were inspired by an article on the Hostinger blog.
Summary Using a plugin to replicate posts and pages is faster than doing so manually, and it eliminates the danger of errors while copying material.
If you only need to copy one post, you might find it easier to utilize WordPress’s built-in “Copy All Content” option, but if you need to copy multiple posts, it’s better to use a plugin. You can clone as many posts, pages, or custom post kinds as you like if you use one of the plugins described above, or if you code your own.
You’ll save time and, more importantly, you’ll avoid accidentally editing your original post when you should have been editing the duplicate post if you do it this way.
Save time, and money, and improve site performance by using:
Expert WordPress Hosting assistance is available 24 hours a day, 7 days a week.
Integration with Cloudflare Enterprise.
With 29 data centers across the world, we can reach a global audience.
With our built-in Application Performance Monitoring, you can improve your performance.
All of this and more is included in a single plan that includes no long-term obligations, aided migrations, and a 30-day money-back guarantee. Check out our plans or speak with a sales representative to find the ideal plan for you.