From time to time, you will find yourself in a situation where you will want to duplicate a page in WordPress for one reason or another and today, we are going to talk a little bit about how to do it right.
If you decide to simply copy and paste the page, that will do it, but it will not move the SEO optimization, page templates, featured images and other associated data. With that in mind, there is a better way to duplicate a page in WordPress, especially if you want to clone an existing page to do a few changes in one of the copies and compare it with the previous version.
So how to duplicate a page in WordPress?
WordPress duplicate page actually takes nothing more than a single click. So let’s go over this quick tutorial and help you find the right WordPress duplicate page plugin!
Table of Contents:
Table of Contents
Duplicate With Plugins
There are thousands of useful WordPress plugins that will save you a lot of time and effort, like wpDataTables.
Some plugins can help you duplicate a page in WordPress. Some of them are paid for, some of them are free, but if you compare them, you will surely be able to find the right WordPress clone plugin for you.
Plugin Search
So how to duplicate a page in WordPress with a plugin? Well, first you have to find the plugin of your choice. Click on Plugins > Add New in the admin area, find the desired plugin, and choose Install Now.
WordPress will then automatically download and install the plugin and you will be all set to start using it. Keep in mind though that this potion is only working with free plugins.
The Upload Method
If you want to use a paid plugin, the upload method is what you will have to do to add the plugin of your choice to WordPress.
First, you will have to download the plugin from the source, then go to WordPress, click on Plugins > Add New. You will see the Upload Plugin option on top of the page. Once you choose this option, you will have to find the downloaded file and install it.
Another method of installing plugins using an FTP client, but that is the least beginner-friendly option.
WordPress copy page is easy with the use of the right plugin, so let’s take a look at some of them and the way they work to help you choose.
Duplicate page plugins
Duplicate Page
Duplicate Page is a great plugin if you want to WordPress duplicate post. You can duplicate your pages, posts and custom post by just one click and it will save as your selected options (draft, private, public, pending).
All you have to do to duplicate WordPress page with this plugin are these 4 simple steps:
- First Activate Plugin.
- Go Select to Duplicate Page settings Menu from Settings Tab and savings settings.
- Then Create New Post/Page Or Use old.
- After clicking on duplicate this link, then duplicate post/ page will be created and saved as draft, publish, pending, private depending upon settings.
Duplicate Post Plugin
The Duplicate Post Plugin allows you to duplicate pages in WordPress while also providing you with a number of useful customization options. There is also an option of adding a pre-set suffix or prefix to the title of your cloned page or post.
How to duplicate page in WordPress with this plugin? Just follow these 4 simple steps:
- Install and activate the Duplicate Post Plugin.
- Click on Pages > All Pages
- Find the post you want to clone and you will find two options: Clone and New Draft.
- If you want to WordPress clone page, click on the Clone option. However, if you want duplicate pages WordPress and start making further changes immediately, click on New Draft. Post editing, you can choose to Save Draft or Publish.
This Plugin also offers a number of options for copying not only content but also dates, status, attachments and more.
Post Duplicator Plugin
Post Duplicator Plugin will allow you to duplicate page in WordPress by cloning an exact replica of the original page or post while retaining the custom fields at the same time. To copy a page in WordPress with this plugin, follow these simple steps:
- Install and activate the Post Duplicator Plugin.
- Choose the page or post you want to duplicate and click on Duplicate Page/Duplicate Post.
- You will get a cloned copy of your page or post with the default suffix Copy at the end of its title.
Duplicating without Plugins
You can WordPress duplicate page without a plugin, but keep in mind that before doing so, you should create a backup of your website and all its data.
However, to duplicate WordPress pages without plugins, you will have to use coding. If you are a developer, the process will be fairly easy. However, if you are an absolute beginner, you should probably consider finding a plugin to do the heavy lifting for you.
Add this code:
Function for post duplication. Dups appear as drafts. User is redirected to the edit screen
/*
* Function for post duplication. Dups appear as drafts. User is redirected to the edit screen
*/
function wpdt_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’, ‘wpdt_duplicate_post_as_draft’ );
/*
* Add the duplicate link to action list for post_row_actions
*/
function wpdt_duplicate_post_link( $actions, $post ) {
if (current_user_can(‘edit_posts’)) {
$actions[‘duplicate’] = ‘Duplicate’;
}
return $actions;
}
add_filter( ‘post_row_actions’, ‘wpdt_duplicate_post_link’, 10, 2 );
Once complete, you will see a Duplicate option in the All Pages or All Posts section.
By editing WordPress functions.php file, you can add the code snippet to your currently active theme. Find the Appearance tab on the left-hand side of WordPress dashboard and click on Editor. On Editor page, choose the functions.php file from right-hand side list of files.
Duplicate a Page in WordPress using FTP
If you want to keep your theme’s functions file tidy, you should paste above code snippet in a separate file and then call it in your functions.php file like in the example below:
require get_template_directory() . '/inc/duplicate-post.php';
inc is a folder inside your theme folder, and the file containing above code snippet called duplicate-post.php.
Upload all files you have changed using an FTP Client to your WordPress installation.
Once you have done that, you can go to Posts on your WordPress dashboard (Posts -> All Posts), find the post you want to copy, and choose the Duplicate option underneath the Post title.
FAQ on duplicating a page in WordPress
How do I clone a page in WordPress without losing my mind?
Well, you’re in luck! Duplicating a page in WordPress is a piece of cake. You can use a WordPress duplicate post plugin or do it manually.
The plugin route is super straightforward. Install, activate, and voila! You can clone pages with a click.
If you’re going old school and want to clone WordPress page without plugin, it’s a bit more hands-on. You’d copy the content, create a new page, and paste it. Easy peasy!
What’s the difference between copying a post and a page?
Ah, the age-old WordPress question. So, posts and pages in WordPress are like cousins. They’re similar but have different purposes.
When you’re copying a WordPress post, you’re duplicating content typically found in your blog section.
On the other hand, when you’re duplicating a page, you’re replicating static content like ‘About Us’ or ‘Contact’. The process is pretty much the same, especially if you’re using a WordPress duplicate post plugin. Just remember where you’re at – post or page!
Can I replicate custom post types too?
Absolutely! Copying WordPress custom post type is just as doable. Most of the duplicate post plugins out there support custom post types.
So, if you’ve got a custom portfolio or testimonial section, you can replicate those with ease. Just ensure the plugin you choose supports this feature. And if you’re doing it manually, the process is pretty much the same as copying a WordPress post.
Do I need to worry about SEO when duplicating?
Great question! When replicating WordPress content, you might run into SEO issues if both the original and duplicate content get indexed. It’s like having twins and not being able to tell them apart. To avoid this, you can set the duplicated content to ‘draft’ or use a canonical tag.
Some WordPress duplicate post plugins even have features to help you manage SEO concerns. So, always be on the lookout!
How do I duplicate a page with all its settings?
Ah, you want the whole shebang, huh? When you’re looking to duplicate page settings, you’re not just copying content. You want the same layout, widgets, and all that jazz.
Most WordPress duplicate post plugins will do this for you. They’ll clone the page, complete with its settings, so you don’t have to set up everything again. It’s like getting a WordPress clone page with the same DNA!
Can I copy a page from one WordPress site to another?
Oh, going intergalactic, are we? Yes, you can! This is a bit more involved than just duplicating a page in WordPress.
You’d need to export the page from one site and import it to the other. There are plugins that can help with this, or you can do it via the WordPress database duplicate option. Just ensure you’ve got all the same themes and plugins on the second site to avoid any hiccups.
What about duplicating blocks? Is that a thing?
You bet it is! With the rise of the Gutenberg editor, copying WordPress blocks has become a thing.
You can duplicate individual blocks within a page or post. It’s super handy if you’ve designed a block you’re particularly proud of and want to use it elsewhere.
No need to recreate the wheel, just duplicate and roll!
Can I duplicate a page with its comments?
Well, diving deep, aren’t we? Typically, when you’re duplicating a page in WordPress, comments aren’t copied over.
But, if you’re keen on keeping those conversations alive, some plugins might help. Just ensure you’re not confusing your readers with duplicate conversations on different pages. It’s like a déjà vu they didn’t sign up for!
How do I handle duplicate categories and tags?
Ah, the nitty-gritty details! When you’re duplicating a page in WordPress, the categories and tags can come along for the ride.
If you’re using a WordPress duplicate post plugin, there’s often an option to choose what you want to copy. So, if you don’t want to end up with duplicate categories and tags, just uncheck those options. Keep your backend clean and tidy!
Is there a way to backup before duplicating?
Safety first, right? Absolutely! Before you dive into replicating WordPress content, it’s smart to have a backup.
There are plenty of plugins out there that can help with backup and restore WordPress page options. It’s like having a safety net before trying a trapeze act.
Ending thoughts on how to duplicate a page in WordPress
There are many reasons why a person would want to duplicate a WordPress page and there are several ways to do it. So how to duplicate a page in WordPress? The easiest option is to find the right plugin to duplicate post WordPress quickly and easily.
You can also play around with some coding and clone a WordPress site without plugins. The third option is duplicating pages in WordPress using FTP. All options are effective so it all boils down to your personal preference and skill levels.
If you enjoyed reading this article on how to duplicate a page in WordPress, you should check out this one about how to reset WordPress.
We also wrote about a few related subjects like how to edit HTML in WordPress, how to embed video in WordPress, how to change WordPress URL, how to add JavaScript to WordPress, how to edit WordPress user roles and how to add WordPress featured image.