How to Duplicate Pages in WordPress Both With Manual and Plugins

How to Duplicate Pages in WordPress

There are various scenarios in which you need to create a new page from another page. For example, if you want to create a similar page with minor changes, duplicating an existing WordPress page can save time and effort.

Additionally, if you are making major changes to a page, it may be useful to create a duplicate page to test the changes before publishing them on the live website.

By default, WordPress does not have the ability to duplicate pages or posts. But don't worry this article will guide you completely to create duplicate page or post in WordPress, both manually and using plugins

In this guiding article, we’ll look at multiple ways you can duplicate your WordPress page or post.

Different Methods to Duplicate WordPress Pages or Posts?

There are three ways to duplicate a page or post in WordPress. You can either use a plugin or do it manually use the code or with the assistance of the Gutenberg editor.

  • Duplicate WordPress Pages Using Block/Gutenberg Editor
  • Duplicate WordPress Pages By Editing functions.php File
  • Duplicate WordPress Pages Using Plugins

Duplicate WordPress Pages Using Gutenberg Editor

If you have installed a premium WordPress theme on your website, you must have used the user-friendly Gutenberg editor. It allows you to edit different elements of your website without any hassle.

In addition, you can also duplicate a page or post from your website with the help of the Gutenberg editor. This is the simplest method to create a copy of your WordPress post or page. Read follow steps how you can do this with ease.

Step1: In the first method click on Edit button of the Page you want to duplicate in your dashboard. Then click the Ellipses menu and select "Copy all content".   

Step 2: Now return to the dashboard and click on New Page. Write a title for the new page

Step 3: Paste the copied content into it.

Step 4: Publish the page and see the result.

This is how you can manually duplicate a page or post in WordPress without installing any plugins. Second manual method of duplicating your WordPress page is editing "function.php" file.

Duplicate WordPress Pages By Editing functions.php File

It’s easy to duplicate pages using a snippet code in the function.php file. But make sure to create child theme before making any changes in function.php file.

A child theme allows for customization without affecting the parent theme's code. This means any changes made to the child theme, such as adding a page duplication snippet code to the functions.php file, will not be overwritten by updates to the parent theme.

Here are the steps to duplicate a WordPress page by adding following snippet code in the function.php file.

function duplicate_page() {
    global $wpdb;
    if (! (isset($_GET['post']) || isset($_POST['post']) || (isset($_REQUEST['action']) && 'duplicate_page' == $_REQUEST['action']))) {
        wp_die('No page to duplicate has been supplied!');
    }
    $post_id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
    $post = get_post($post_id);
    $current_user = wp_get_current_user();
    $new_post_author = $current_user->ID;
    if (isset($post) && $post != null) {
        $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 . ' (Copy)',
            'post_type'      => $post->post_type,
            'to_ping'        => $post->to_ping,
            'menu_order'     => $post->menu_order
        );
        $new_post_id = wp_insert_post($args);
        $taxonomies = get_object_taxonomies($post->post_type);
        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);
        }
        $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;
                $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);
        }
        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_duplicate_page', 'duplicate_page'); 
function add_duplicate_page_link() {
    global $post;
    if (current_user_can('edit_posts')) {
        echo '<a href="' . admin_url('admin.php?action=duplicate_page&post=' . $post->ID) . '" title="Duplicate this page

Step 1: Login to your WordPress website and go to the “Appearance” tab. Click on the “Theme File Editor” option, which will take you to the theme editor.

Step 2: Click on the “functions.php” file, which is located on the right-hand side of the screen. Scroll down to the end of the code, and add the following code snippet, and click “Update File

 

Step 3: Return to dashboard, click on pages or post, new “Duplicate” buttons will appear below every post and page. You can duplicate any page from your WordPress website.

Duplicate WordPress Pages or Post Using a Plugin

Are you looking for an efficient way to duplicate a WordPress page? Well, you're in luck. There are various plugins available on the official WordPress directory such as Duplicate Page, that can assist you in easily duplicating a page or post in WordPress

Duplicate page is one of the most popular page duplication plugins. Plugin settings provides users with the ability to select page editor, status you want to assign after creating duplicate page, any redirection you want to create.

So, without further ado, let's dive into the process of copying WordPress page or post using “Duplicate Page” WordPress plugin.

Step 1: The first step is to install the Duplicate Page and Post plugin. To do this, log in to your WordPress dashboard and navigate to the Plugins section. Click on "Add New" and in the search bar, type "Duplicate Page and Post." Once you find the plugin, click "Install Now"

Step 2: Click on "Activate" button to activate the installed plugin

Step 3: Once you have installed and activated the plugin, navigate to the page that you want to duplicate. "Duplicate" button will appear, just click on it and the page will be duplicated.

Step 4: After duplicating the page, you will need to make some edits to it to differentiate it from the original page. This includes changing the page title and updating the content. Make necessary change and click "Publish"

Step 5: You can change plugin setting as per need like which editor you want to use for duplicated page, default status of copied page, or redirection you want to create.

It is one of the easiest and most convenient methods to duplicate a page or post in WordPress. To duplicate a page with this method, first, you need to install a plugin on your website.

Duplicate WordPress Pages or Post Using HTML Code

It is an effective method to duplicate a page or post in WordPress. The only drawback of this method is that it is time-consuming and you need to have a little bit of understanding of the HTML language.

To duplicate a page using this method, first, you need to open the post or page you want to duplicate. Afterwards, go to options to open the HTML code editor. Now copy all the code present in that section.

After copying the given code, you have to create a new page or post. Go to the options of that newly created page to open the HTML code editor. Now paste the code copied in the beginning. Hooray! The page has been copied successfully; you can switch to the visual editor to see the duplicate copy of the page.

Best Plugins to Copy a WordPress Page

As we mentioned earlier, various plugins can assist you in cloning a page or post in WordPress. We have sorted some of the best of them to help you choose the perfect one to install on your WordPress website. Let’s look at some of the best plugins to duplicate a WordPress page.

Duplicate Page

If you want to duplicate the pages of your WordPress website then the duplicate page plugin can be a great fit for you. You can easily edit pages, and publish them after duplication with the help of this plugin.

To get started with this plugin first you need to install it on your WordPress website. After installation, activate it and follow these simple steps to duplicate pages or posts from your website.

  • Navigate to the WordPress admin panel.
  • Select all pages or all posts option from the admin panel.
  • Now, select the pages or posts that you want to duplicate.
  • Click the duplicate button to create copies of the selected posts or pages.

Smart Manager

The smart manage plugin allows you to duplicate any kind of WordPress post from your website. With the help of this plugin, you can duplicate multiple posts or pages in a single click using the Excel sheet editor.

To use this plugin first, you need to install and activate it from the plugins section of your WordPress admin dashboard. After installation, go to the smart manage plugin and select the pages you want to copy and click on the duplicate button.

Duplicate Page and Post

The duplicate page and post are one of the most popular page duplication plugins. It allows you to duplicate various pages and posts effectively from your WordPress website.

To duplicate pages and posts with this plugin download and install this plugin on your website. Follow these simple to get started with page or post duplication.

  • Login to your WordPress admin dashboard and click on the all pages or posts options.
  • Click on the posts or pages you want to duplicate and click on the duplicate button to create their copies.

Conclusion

Creating a copy of a page or post on your website is necessary before editing them if you don’t want to lose its previous layout. We took a look at three different methods to duplicate a page or post in WordPress. You can stick to the method that you found easy and convenient to implement on your website.

So, what are waiting for buddy? Go and implement the page duplication methods practically on your website.

FAQs on Duplicating WordPress Pages

Can I Copy a WordPress Page from One Site and Paste it to Another WordPress Site?

Yes, you can copy a WordPress page from one site and paste it to another WordPress site. One way to do this is by exporting the page's content using the "Export" feature in the WordPress dashboard on the original site, and then importing that content into the WordPress dashboard on the new site using the "Import" feature.

However, keep in mind that some elements of the page, such as images and links, may not transfer correctly and may need manual updation. Additionally, if the page uses custom plugins or themes, these may need to be installed on the new site as well for the page to function properly.

What is the Most Reliable Way to Duplicate Pages?

We discussed, how to duplicate a page in WordPress manually or through plugins. Compared to the plugin method, manual methods aren’t convenient. While copying the code or content manually, a little mistake can ruin all your efforts.

On the other hand, when you use plugins to duplicate pages, there is little or no chance of encountering an error. In addition, the Duplicator plugin is available free of cost on the official WordPress directory. So, there’s no need for you to pay a single penny to use it.

Hence, the use of plugins seems to be the most reliable way to duplicate pages in WordPress.

Difference Between Cloning or Duplicating a Page in WordPress?

Most website owners often gets confused between cloning and duplication of WordPress pages. The only difference both of these terms have is the number of copies created at a time.

In the process of cloning, multiple copies of the selected page or posts can be created at once. On the other hand, in the process of duplication, only one copy of the selected page can be created at a time.

Can I Make Changes to a Duplicated Page or Post?

Yes! You can easily make changes to a duplicated page or post. When you duplicate a page through a plugin you will get to see “clone” and “new draft” options. If you click on the clone option, a duplicate page will be created. You can edit that duplicated page by clicking on the duplicate option when you’re ready to edit it.

You can opt for the “new draft” option if you are willing to edit the page immediately. After clicking on the “new draft” option, the content of that particular page will be copied into the editor.

Back to blog