How to Duplicate a Page in WordPress Without Plugin

How to Duplicate a Page in WordPress Without Plugin

Managing your content using WordPress, one of the best CMS systems in the world, will help you create a structured management system. However, at some point, you may want to duplicate a page. 

Because creating everything again from scratch is tiresome and time-wasting. You might think you can simply copy and paste all the content onto a new page. This works only to a certain extent, as a lot of your formatting, such as features, images, and SEO, will all be lost and will need to be redone.

So, today we are going to show you how to duplicate a page in WordPress without plugin. And, all the ways of replicating a page in WordPress with plugin. Let’s get started. 

How to Duplicate a WordPress Page Without a Plugin

WordPress lets you manage your content quite easily. That involves copying a page without using a plugin. Because when you want to copy a single page or a post-it doesn’t make any sense to install a new plugin. 

Instead, you can use the built-in function “Copy All Content” option to copy the content of any page. 

First, go to the selected page at Pages→ All Pages. Open the page you want to copy. In the editor, you will find the 3 vertical dots icon at the top-right corner of your screen. 

This will open a menu where you need to click on Copy All Content to copy the content in the page editor.

How to Duplicate a Page in WordPress Without Plugin

You must create a new page by clicking on Pages -> Add New. You need to add a title on the new page and right-click on the first block to paste the content.

This is the Duplicate page.

The content from the original post will now be copied to this duplicate page.

The problem with this method is that you can only copy the content, not other things like category, tags, title, and featured image. You’ve to manually copy other items if you want.

So, why not use coding? Yes, you can use a bit of code to copy a page or a post. You can copy the category, tags, title, and featured image.

To duplicate a page, paste this code on your functions.php file, 

*
* 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 process for duplicating a page in WordPress is pretty simple. All you have to do is replace the last line of the code above with the following snippet: 

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

Once successfully embed the code above, you should see a Duplicate button in the All Posts or All Pages menu.

Now you know how to duplicate a page in WordPress without plugin. However, you can also use a plugin to do this work. 

Also Read-Why WordPress Featured Image Not Showing with Possible Solutions?

How to Duplicate a Page in WordPress Using a Plugin

Many plugins in the WordPress repository will help you manage your blog site with ease. Similarly there are a lot of plugins that will help you duplicate a WordPress page or a post with ease. 

We will show you how to use a plugin to duplicate a page in WordPress. 

Step 1: Install and Activate the Plugin

First, go to WP Admin→ Plugins→ Add New and type the plugin name in the search box. We are going to install the Yoast Duplicate Post plugin. After installing the plugin, activate the plugin from your WordPress dashboard. 

Yoast Duplicate Plugin

Step 2: Configure the Settings of the Plugin

After installing the plugin, go to Settings -> Duplicate Post from the left sidebar to open the settings page of this plugin. On this page, you’ll find 3 options: What to copy, Permissions, and Display.

What to Copy: Decide what elements you can add to the duplicate page, like Title, Date, Status, Excerpt, etc. 

If you leave something unchecked, it will not be added to the copied post or page. You can check/uncheck other items based on your requirements. You can add a title prefix or suffix to understand which one is the cloned page. Also, you can decide whether you want to copy the category and tags by making changes to the “Do not copy these taxonomies” option.

Configure the Settings of the Plugin

Permissions: You can select who will be allowed to duplicate pages on your site. Keep the default settings. 

Configure the Settings of the Plugin

Display: You will find the options to place the “Copy to a new draft” or “Clone” link on your WordPress admin panel. Again, it is better to keep the settings as it is.

Step 3: Duplicate a Page or Post

You are done with the settings. Now, if you go to Pages -> All Pages from the left sidebar, you’ll see two new options: Clone and New Draft.

The Clone option will let you create a duplicate page automatically. The page will be added to the existing page list. On the other hand, the New Draft link will not only create a same page, but you’ll also be redirected to the page editor of the newly created page.

Configure the Settings of the Plugin

You can also duplicate pages in bulk. Go to Pages -> All Pages from the left sidebar. Next, you need to select the pages you want to duplicate.click on the Bulk actions dropdown, select Clone from the options, and click on Apply. This will clone all the pages you had selected earlier. 

Want to Clone Pages or Posts in Bulk?

Configure the Settings of the Plugin

Alternative Plugins to Duplicate Pages in WordPress

However, Yoast Duplicator Post is not the only plugin that will help you duplicate a page in WordPress. There are other plugins as well. Here are some plugins that will help you duplicate a page or posts.

1. Post-Duplicator

Post Duplicator

This is one of WordPress’s best plugins for duplicating a post or page. With over 10000+ active installations, this plugin is easy to install and set up. And you can create an exact copy of any post or page without hassle.

2. Duplicate Page

Duplicate page

This plugin allows you to duplicate posts, pages, and custom post types. When you install this plugin, you can use the “Duplicate This” option to clone a page. Moreover, you will have a flexible settings option to customize everything.

3. Duplicate Page and Post

Duplicate Page and post

This plugin works flawlessly on both the Gutenberg and the Classic WordPress editors. This plugin lets you add a post suffix to the settings page to easily differentiate between the original and the duplicate page.

Read More: Why My WordPress images not showing?

FAQ(s)

How do I duplicate a page in WordPress without plugins?

To duplicate a page in WordPress without plugins, 

You need to go to Pages -> All Pages from the left sidebar and then open the page you want to clone. Next, click on the 3 vertical dots icon at the top-right corner of your screen. Now create a new page by clicking on Pages -> Add New.

How do I copy an existing page in WordPress?

To copy an existing page in WordPress, click on Posts or Pages in your dashboard. Click the ellipses menu (the three vertical dots) to the right of the post or page you want to copy. Select Copy.

How do I duplicate a page in WordPress Gutenberg?

In the Gutenberg editor you can easily duplicate the page by going to the ‘More tools and options’ settings and clicking the ‘Copy all content’ option. Now the entire content will be copied.

How to duplicate a page in WordPress with elementor?

To duplicate a page created with Elementor, save your designed page as a template and then import that template into other pages as needed.

Final Word on How to Duplicate a Page in WordPress Without Plugin

So, now you know how to duplicate a page in WordPress without plugin and also with a plugin. We hope this article helped you understand how to perform this task. 

If you have any queries, do write to us. 

1 thought on “How to Duplicate a Page in WordPress Without Plugin”

Leave a Comment

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

Scroll to Top