How to Duplicate A Page In WordPress Without Or With a Plugin

How to Duplicate A Page In WordPress Without Or With a Plugin

Do you want to know how to duplicate a page in WordPress with or without a plugin? No worries because you have discovered the right page. 

There are several ways to duplicate a WordPress page. Here, I will show you the most convenient methods of doing it. It includes: 

  1. By Using WordPress’ Default Block Editor- Gutenberg
  2. Without Using a Plugin- By Adding a PHP function
  3. And Finally, By Using a Plugin

Among these methods, choose the one that is convenient for you. So, why are you waiting? Let’s dive in! 

What is A Page in WordPress?

What is A Page in WordPress

According to WordPress, 

“A page is an area on your site where you can display content. A page can be about anything at all. Some of the most common pages on a website include Home, About, and Contact pages.”

WordPress

There is no limit to adding new pages in WordPress. Depending on your necessity, you can create, edit, and update as many times as you want. 

WordPress introduced “Pages” in version 1.5 in 2005. 

Major Differences Between A Page and A Post

WordPress Page WordPress Post
It is timelessIt is timely 
It can not be shared on social mediaIt can be shared on social media
It is managed as child and parent pagesIt is organized by categories and tags
It does not need an author and published dateIt has an author and published date
It can not be added to RSS feed syndicationIt can be added to RSS feed syndication

The necessity of Duplicating Pages or Posts in WordPress

You may need to duplicate pages or posts for numerous good reasons. But the main common 2 reasons are: 

If you notice, you will see that most successful websites maintain design consistency. It means all the pages look alike. 

So, it would not be wise to design a page and use it only for one time. Plus, if you want to design new pages, it will take more money, time, and effort. 

In this regard, duplicating pages or posts will make you more professional and profitable. However, if you want to

How to Duplicate A Page In WordPress- Step By Step Guide 

WordPress is freedom! You can manage your content smartly here. So, when the question of duplicating a page/post arises, there is always a solution. 

First, I will discuss the process by using the Gutenberg Block Editor. 

Method 1: Duplicate a WordPress Page Using WordPress Default Block Editor- Gutenberg

Honestly speaking, it would not be wise to install a plugin to clone a single page. Therefore, you should utilize the default “Copy All Content” option to get your work done. 

Don’t worry if you are not familiar with the Gutenberg block editor. It is WordPress’ default editor. When you are editing with WordPress, you are using Gutenberg. It’s that simple. 

Let’s start the process! 

This method of duplicating a page is divided into 2 parts.

  • Part 1: The Content Copying Part from an Existing Page
  • Part 2: Adding a New Page and Pasting the Copied Blocks/Content Part

Part 1: The Content Copying Part from an Existing Page

The Content Copying Part from an Existing Page

First, log in to your WordPress dashboard. Then navigate to the Pages→ All Pages. Enter the page you want to duplicate. 

Now, look at the top right corner of the page editor section and find out the three vertical dots icon. Click on this icon. 

Choose the “Copy All Content” option from the menu to copy the entire page including everything (blocks, texts, images, videos, buttons, etc.) 

Part 2: Add a New Page and Paste the Copied Blocks/Content 

Now, it is time to create a new page. To do so, again go to the Pages section from your WordPress dashboard. Click on “Add New” (Pages→ Add New) 

Add a New Page and Paste the Copied Blocks/Content

Add a title to this newly-created page as you need. Then place your cursor on the first block of your page and right-click on it. A pop-up menu will appear. Select the “Paste” option to fill the empty page with your copied blocks/content. Hurrah! It’s done. 

pasting the copied content

But have you noticed any difference between those two pages? Yes, the featured image, category, and tags are missing. You have to add them manually if you need. 

Does it seem awkward and time-consuming to you? No worries because there is another method that lets you copy all the content of a page along with its featured image, category, and tags. 

To do it, you have to just add some PHP codes. So, why are you waiting? Let’s learn the next process!

Method #2: Duplicate a WordPress Page Without a Plugin- Using PHP Function

Another method of duplicating a WordPress page is using php function codes. The function codes I am talking about will work as a plugin. After adding the codes, you will see a duplicate button for each post, page, and custom post type.

But this process might seem complicated. Therefore, I am making it super easy for you. Just follow the below instructions. 

From your WordPress dashboard, go to “Appearance” and then click on the “Theme File Editor” option. (Appearance→ Theme File Editor) 

Appearance→ Theme File Editor

Now, look at the right side of the screen. Find out and click on the “functions.php” file under the “Theme Files” section.

At this stage, you just need to navigate to the bottom of this functions.php file. And then paste the below code: 

/*

*

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

Lastly, hit the “Update File” button to save the codes. 

how to duplicate a page in WordPress: adding the php file

To check whether it is working or not, go to the Pages or Posts tab from the dashboard. Surely, you will find a new option labeled as “Duplicate” under each list item.

When you hit the Duplicate option, a new duplicated page or post will be created. You can edit them as well. Finally, publish them when done. 

Method #3: Duplicate a WordPress Page Using a Plugin

One of the easiest ways to clone a page or post is to use a plugin. You will find numerous plugins available on the market. 

Today, I will show you how to duplicate a page in WordPress using the “Duplicate Page” plugin. 

Step 1: Plugin Installation and Activation Part

From the WordPress dashboard, go to Plugins→ Add New. Then write “duplicate page” in the search box. The desired plugin will appear. Hit the “Install Now” button and then “Activate”. 

Plugin Installation and Activation Part

Step 2: Page or Post Duplication Part

After activating the plugin, browse to a post, page, or custom post type as you need. As I will show you the page duplication process, I will go to All Pages. 

If you hover your cursor over a specific page, you will find the “Duplicate This” option. Click on it. 

Page or Post Duplication Part

As soon as you click on it, a clone of that page will be automatically created with the same name. You will find the newly cloned page in the existing page list. But its status will be Draft, not Published. 

how to duplicate a page in WordPress- the duplicated page

Edit its title, content, slug, etc. When you are ready to go live, just hit the “Publish” button. 

edit the content and publish at last

Step 3: Configuring the Plugin if You Want Them Automatically Published Just After Cloning 

If you want to automatically and instantly publish the page that you have just duplicated, configure the plugin as follows.

Go to the Settings option from the left sidebar of your WordPress dashboard. Then click on “Duplicate Page” (Settings→ Duplicate Page)

configuring the duplicate page

Then click on the dropdown menu under the “Duplicate Post Status” option. Select “Publish” from the available options, and finally hit the “Save Changes” button. 

duplicate page settings

Some Alternative Plugins to Duplicate Pages in WordPress

You will find a bunch of page and post-duplicating plugins on the web. Among them, here I am presenting the most effective ones. 

1. Yoast Duplicate Post 

Yoast Duplicate Post

Yoast Duplicate Post stands supreme among others. With the help of this plugin, you can clone any type of page and post. It allows you to edit the newly duplicated page/post. 

Most amazingly, its bulk action will let you clone multiple pages or posts at a time effortlessly. 

Some Key Features of Yoast Duplicate Post

  • 4 million+ active installation
  • One Click to Duplicate Posts and Pages
  • Bulk Clone
  • Improvement of Your Workflow
  • Simple and Easy, But Powerful
  • Free! 

2. Post Duplicator

Post Duplicator

With Post Duplicator, you can duplicate any post exactly as it is. Plus, it is easy to use. It also supports custom post types, custom taxonomies, and custom fields.

But remember that the comments will not be duplicated in the new post.

Some Key Features of Post Duplicator

  •  200,000+ active installation
  • Easy and quick
  • Supports custom post types, taxonomies, and fields
  • One-click to duplicate 

3. Duplicate Page and Post

Duplicate Page and Post

You can also clone particular pages, posts, and custom post types using Duplicate Page and Post. Super fast and lightweight. Let’s see what it offers! 

Some Key Features of Duplicate Page and Post

  • 100,000+ active installation
  • Particular page, post, custom post(CPT) cloning option 
  • Supports both Classic and Gutenberg Editor
  • Opportunity to add Post Suffix
  • Option to add custom text for duplicate link button
  • Window to select Duplicate Posts Status.

4. WP Post Page Clone

WP Post Page Clone

WP Post Page Clone will also allow you to duplicate or clone any sort of post or page in just one click.

Some Key Features of WP Post Page Clone

  • 90,000+ active installation
  • Duplicate post with its settings
  • Duplicate page with its settings
  • Cross Browsers Support

5. Page and Post Clone

Page and Post Clone

If you are looking for a solution to how to duplicate a page in WordPress, Page and Post Clone plugin is for you. 

Some Key Features of Page and Post Clone

  • 90,000+ active installation
  • Duplicate page with the title
  • Duplicate post with the title

FAQ(s)

1. Can I duplicate a page in WordPress using codes?

Answer: Of course, you can duplicate a page in WordPress using codes. To do it, you have to enter the functions.php file from the Theme File Editor section. Once you have access, just add the codes accordingly that we have provided in this blog.

2. How do I duplicate a page in WordPress Elementor?

Answer: if you are using an Elementor page, you can easily duplicate it. Open the page you want to duplicate. Then navigate to the Save Options arrow, located at the right of the UPDATE button. Now, hit the “Save as a Template” option. You are done. Use this template where you need it. 

3. How can I duplicate multiple pages in WordPress?

Answer: You can duplicate multiple pages in WordPress using a plugin. For example: you can use Yoast Duplicate Post or Duplicate Post plugin. Go to Pages and select your desired ones. Now, apply the bulk action feature to copy multiple pages. 

4. How to duplicate a page in WordPress Gutenberg?

Answer: Duplicating a page using the default Gutenberg block editor is much easier. Open the page and click one the 3 vertical dots icon. Select “Copy All Content”. Then create a new page and paste the copied elements. 

Wrapping Up 

I think this article has taught you how to duplicate a page in WordPress. Now, you know both ways (with or without a plugin). Therefore, serve your purpose with the best-suited method.

If you have any questions or recommendations, please do not forget to comment. 

Learn and Enjoy WordPress! 

Leave a Comment

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