How To Duplicate A Page Or Post In WordPress

There are a number of cases where you may need to duplicate a page or post in WordPress. You may want to create a new post using a similar format, or you may want to make changes to a page without editing the live version.

You could just copy and paste your content to a new draft, but this would not include the featured image, SEO settings, categories, tags, or other metadata associated with the post.

In this tutorial, you’ll see how to create an exact copy, metadata included, with a single click.

How To Duplicate WordPress In Posts & Pages

Before you can duplicate posts or pages in WordPress, you’ll need to install and activate the Duplicate Post plugin:

Once you’ve activated it, go to Posts > All Posts in your WordPress dashboard.

Now, when you hover your mouse over one of your posts, you’ll see two new options:

  • Clone — This will duplicate the post, using its content and settings to create a new draft, but you won’t be redirected to the post editor.
  • New Draft — This option does the same thing, except it will automatically open the post editor so you can start working on the duplicate post right away.

A new “Copy to a new draft” option will also appear in the admin bar, both on the post editor and on the live version of the post:

Duplicate Page in WordPress

These options are also available for pages, and the process looks exactly the same.

How to Duplicate Custom Post Types in WordPress

You can also extend the same functionality to your custom post types.

Make sure you’ve installed the Duplicate Post plugin, go to Settings > Duplicate Post, and click over to the Permissions tab at the top.

Duplicate Page in WordPress

Under “Enable for these post types,” select any custom post types you want to have the option to duplicate.

After saving your changes, you will be able to duplicate custom post types just like posts and pages.

How To Duplicate A Page or Post Without Plugins

Want to duplicate a page or post in WordPress without adding another plugin? You can easily do it manually. By either updating your theme’s files or copying content directly. Here, we’ll cover two simple methods that can help you duplicate content on your site. While keeping it streamlined and free from extra plugins.

Method 1: Using the functions.php File to Duplicate Posts or Pages

One effective way to duplicate a post or page in WordPress is by adding a bit of custom code to your theme’s functions.php file. This approach is especially useful for users who are comfortable editing code directly in WordPress. Before starting, always make a backup of your site to avoid any accidental data loss.

Steps to Duplicate Content via functions.php

  1. Access the functions.php File:
    • Use an FTP client or your hosting provider’s file manager to locate and open the functions.php file in your active theme.
  2. Add the Custom Code:
    • Insert a code snippet that will enable you to duplicate posts or pages with just a click. Here’s a breakdown of what this code does:
      • Checks if there’s a post to duplicate.
      • Confirms that the user has the right permissions.
      • Gathers all content and data from the original post, including taxonomies and metadata.
      • Creates a new draft that duplicates the content of the original post or page.
  3. Save and Upload the File:
    • Once you’ve added the code, save the changes and upload the updated functions.php file back to your server.
  4. Check the WordPress Dashboard:
    • Go to your WordPress dashboard, and now when you hover over posts or pages, you should see a “Duplicate” link. Click it, and a new draft will be created with all content from the original page or post!

Example Code to Use

function duplicate_post_as_draft(){
    global $wpdb;
    if (! ( isset( $_GET['post']) || isset( $_POST['post'])  || ( isset($_REQUEST['action']) && 'duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
        wp_die('No post to duplicate has been supplied!');
    }

    if ( !isset( $_GET['post']) || !wp_verify_nonce( $_GET['nonce'], basename( __FILE__ ) ) )
        return;

    $post_id = $_GET['post'];
    $post = get_post( $post_id );

    if (isset($post) && $post != null) {
        $new_post = array(
            'post_title' => $post->post_title,
            'post_content' => $post->post_content,
            'post_status' => 'draft',
            'post_type' => $post->post_type
        );

        $new_post_id = wp_insert_post( $new_post );

        $taxonomies = get_object_taxonomies($post->post_type);
        foreach ($taxonomies as $taxonomy) {
            $post_terms = wp_get_object_terms($post_id, $taxonomy);
            wp_set_object_terms($new_post_id, $post_terms, $taxonomy);
        }

        $meta_data = get_post_meta($post_id);
        foreach ($meta_data as $meta_key => $meta_value) {
            update_post_meta($new_post_id, $meta_key, $meta_value[0]);
        }

        wp_redirect(admin_url( 'post.php?action=edit&post=' . $new_post_id ));
        exit;
    } else {
        wp_die('Post creation failed, could not find original post.');
    }
}
add_action( 'admin_action_duplicate_post_as_draft', 'duplicate_post_as_draft' );

With this snippet, you can duplicate any post or page quickly!

Method 2: Manually Copying and Pasting HTML Code

If editing the functions.php file feels a bit daunting, there’s another way to duplicate posts or pages manually by copying the HTML code of a post or page. This method is straightforward and works best if you only need to duplicate a few pages.

Steps to Duplicate Content Using HTML Copy-Paste

  1. Open the Desired Page or Post:
    • Head to the WordPress editor for the page or post you want to duplicate.
  2. Switch to Code Editor:
    • From the settings menu in the editor, switch to the “Code Editor” view to see the raw HTML content of the post or page.
  3. Copy HTML Content:
    • Select and copy all the HTML code from the editor.
  4. Create a New Post or Page:
    • Open a new post or page, then switch to the “Code Editor” and paste the HTML code you copied.
  5. Switch Back to Visual Editor:
    • After pasting, switch back to the “Visual Editor” to view and edit the duplicated content as you would normally.

Is This Method Right for You?

Manual HTML duplication can be a bit time-consuming, so it’s ideal for duplicating only a handful of posts. If you’re duplicating several posts or pages, using the functions.php method or even a plugin might be more efficient.

How to Manually Duplicate a WordPress Page or Post by Copying Code

Need to duplicate a WordPress page or post without a plugin? Manually copying and pasting code is a quick, effective way to replicate content. Especially when you’re only dealing with a small number of pages. Here’s a straightforward guide to help you get it done!

Step 1: Access the Page or Post You Want to Duplicate

To start, go to your WordPress dashboard and open the page or post you want to duplicate. This lets you access the content directly.

Step 2: Switch to the Code Editor

Within the editor, look for the option to switch to the Code Editor. This is often found under More Tools & Options. Switching to this mode allows you to view and copy the HTML and other code that makes up the page structure.

Step 3: Copy the Code

Now, carefully highlight and copy all the code from the Code Editor. Copying the entire code accurately is essential. As missing even a small part can lead to layout or functionality issues in the duplicated page.

Step 4: Create a New Page or Post

Go back to your dashboard and select New Page or New Post to start creating a duplicate.

Step 5: Open the Code Editor for the New Page or Post

In the new page editor, switch to the Code Editor once again. This prepares the editor to receive the copied code without any formatting issues.

Step 6: Paste the Copied Code

Paste the copied code directly into the Code Editor of the new page or post. Make sure everything is pasted correctly to maintain the original layout and settings.

Step 7: Switch Back to the Visual Editor

Once pasted, switch back to the Visual Editor to preview the new page or post. You should see an exact duplicate of the original content, including images, text, and formatting.

Step 8: Review and Publish

Review the duplicated content to ensure everything looks right. Make any necessary adjustments, and hit Publish when you’re ready.

who can see private posts in WordPress

Quick Tip: If you frequently need to duplicate multiple posts or pages. Using a WordPress duplication plugin can save you time and reduce the chances of human error. Especially with larger projects.

How to Enable Cloning in WordPress Using functions.php

Want an easy way to duplicate posts and pages in WordPress? You can set up a simple cloning feature using WordPress’s functions.php file. This step-by-step guide will show you exactly how to enable cloning in WordPress without needing a plugin.

Let’s get started on making your WordPress content management even easier!

Step 1: Backup Your Site for Safety

Before making any changes to your site’s files, always back up your website. This precaution ensures that if anything goes wrong, you’ll have a safe point to restore from. While most hosting providers offer easy backup options. Using a reliable backup plugin can give you even more control and security. Popular plugins like UpdraftPlus and BackupBuddy allow you to schedule backups. Store copies in remote locations like cloud storage, and restore your site with ease. These plugins are excellent for regular backups, giving you peace of mind as you work on your site.

Step 2: Access the functions.php File

To enable cloning, you’ll need to edit the functions.php file of your active theme. This file controls many key features of your WordPress site, so follow these steps carefully:

  1. Use a File Manager or SFTP to access your WordPress files.
  2. Navigate to wp-content > themes > your active theme.
  3. Open the functions.php file in a code editor or through your hosting control panel.

Step 3: Add the Cloning Code

Copy and paste the following code at the bottom of the functions.php file to create a cloning function for posts and pages:

// Function to duplicate posts and pages
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']));
    $post = get_post($post_id);

    // Set the new post author
    $current_user = wp_get_current_user();
    $new_post_author = $current_user->ID;

    // Create the post duplicate
    if (isset($post) && $post != null) {
        // Logic to create a duplicate post goes here
        // 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 duplicate link to action list for posts
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);

This code creates a “Duplicate” option that appears when you hover over a post, allowing you to create a draft clone of any post.

Step 4: Enable Cloning for Pages

If you want the cloning option for pages as well, update the final add_filter line to include page actions:

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

Step 5: Save and Upload the File

Once you’ve added the code, save the functions.php file and upload it back to your theme directory using your file manager or SFTP client.

Step 6: Verify the Cloning Feature

Head over to your WordPress Dashboard and open your posts or pages list. When you hover over a post or page, you should see a new “Duplicate” option. Click this option to instantly create a duplicate draft of the content!

Why Enable Cloning for WordPress Content?

Enabling cloning can save you tons of time. Especially when creating similar posts or pages. This solution is lightweight, straightforward, and doesn’t require additional plugins, which helps keep your WordPress site fast and clutter-free.

By following these steps, you can easily enable content duplication in WordPress using functions.php. This lets you manage and duplicate content quickly without relying on third-party plugins. Keeping your website streamlined and efficient.

How to Streamline Your WordPress Experience Beyond Page Cloning

Cloning pages is a fantastic way to boost productivity in WordPress. But there are many other techniques that can take your workflow. And site management to the next level. Here’s how to go beyond page cloning and unlock an optimized, seamless WordPress experience.

1. Effortlessly Migrate Content Between Sites

Save Time with Content Migration: Moving pages and posts between WordPress sites doesn’t have to be a manual, time-consuming task. Plugins like All-in-One WP Migration make it easy to transfer your content across sites. Ensuring your branding and messaging stay consistent. Instead of recreating pages from scratch, this tool streamlines content migration. Saving you valuable hours.

2. Create Safe Testing Environments with Development Site Cloning

Mirror and Test Safely: Making significant updates to your WordPress site without risking errors on your live site is critical. Tools like WP Stagecoach and Duplicator let you create exact copies of your site for testing and development. Working in a cloned environment allows you to experiment with new features, layouts, or plugins. Without impacting the user experience on your main site.

3. Automate Repetitive WordPress Tasks

Save Time by Automating Updates and Backups: Automating routine WordPress tasks can streamline your workflow. Reduce the need for manual upkeep. WP-Cron, for example, enables you to schedule regular backups, updates, and content publications. Helping you stay focused on more strategic tasks. While keeping your site secure and updated in the background.

4. Streamline Edits with Bulk Editing Tools

Efficiency at Scale with Bulk Editing: Instead of manually adjusting settings for individual posts and pages. Tools like Bulk Edit allow you to apply changes across multiple items at once. With this plugin, you can easily update categories, tags, or post visibility. Across several posts, saving time and making large-scale changes more manageable.

Duplicate Page in WordPress

5. Enhance Site Performance with Caching

Improve Speed and User Experience: Website loading speed is essential for user retention and search engine rankings. Caching plugins like W3 Total Cache can significantly improve site speed. Leading to better user experiences and potentially higher rankings on search engines. This optimization is a quick win for overall site performance and user satisfaction.

Incorporating these advanced strategies. Like content migration, development site cloning, automation, bulk editing, and caching. Into your WordPress management routine can help you manage your site with greater efficiency. Not only can you boost productivity, but you’ll also deliver a faster, more polished experience to your visitors. Take advantage of these tools to streamline your WordPress experience beyond simple page cloning.

How the Post Duplicator Plugin Makes WordPress Content Duplication Easy

If you’re managing a WordPress site and need to duplicate posts or pages regularly. The Post Duplicator plugin could be your best friend. This powerful tool allows you to create exact copies of your content in just a few clicks. Helping you save time and maintain consistency across your site without the hassle. With its straightforward interface and reliable functionality. The Post Duplicator plugin is perfect for everyone. From WordPress beginners to seasoned pros.

Why Use the Post Duplicator Plugin for WordPress?

The Post Duplicator plugin simplifies the duplication process, allowing you to copy not only standard posts or pages but also custom post types, fields, and taxonomies. This all-in-one capability makes it ideal for creating a cohesive structure across your site, making it especially valuable for businesses or bloggers using recurring templates.

Key Features of the Post Duplicator Plugin:

Full Content Duplication: It’s not just the content that gets duplicated. The plugin also replicates custom post types, metadata, and taxonomies. This all-encompassing approach means you don’t have to worry about re-adding custom elements every time you duplicate a post.

User-Friendly Interface: With a simple layout and intuitive options. The plugin is designed for users of all skill levels. You don’t need advanced WordPress knowledge to navigate. Just install, activate, and you’re good to go.

How to Use the Post Duplicator Plugin to Duplicate WordPress Content

Duplicating WordPress posts and pages with the Post Duplicator plugin is quick and easy. Here’s a step-by-step guide:

1. Install and Activate the Plugin: Go to your WordPress dashboard. Navigate to Plugins > Add New, and search for “Post Duplicator.” Install and activate the plugin to start using it.

2. Navigate to Your Content: After activation, go to Posts > All Posts or Pages > All Pages to find the content you want to duplicate.

3. Duplicate with One Click: Hover over the post or page you wish to duplicate. You’ll see options like Duplicate Post or Duplicate Page. Click the option, and the plugin will create an identical copy of your content.

That’s it! The duplicated post or page will appear as a draft, ready for you to edit or publish as needed.

Why the Post Duplicator Plugin Is Perfect for Content Management

Whether you’re building out a blog with similar layouts or managing a business site with recurring service pages. The Post Duplicator plugin streamlines content management. By generating exact copies of your posts. The plugin reduces the time spent on repetitive tasks. Making it easier to maintain an organized site. Plus, it operates smoothly without impacting site performance. Ensuring that your WordPress site remains fast and responsive.

In Summary: The Post Duplicator plugin is a simple, reliable solution for duplicating WordPress posts, pages, and custom content types with just a few clicks. If you’re looking for an easy way to keep your content organized and efficient, give this plugin a try!

Customizing Duplicate Post Settings

There are some other options you can adjust to further customize your workflow. To edit these settings, go to Settings > Duplicate Post in your WordPress dashboard.

What to copy

Duplicate WordPress In Posts & Pages

This section determines what specific data is copied when you duplicate a post.

By default, the title, excerpt, content, featured image, page/post template, post format, and menu order will be copied. You can disable any of these, and you can opt to include the date, status, slug, author, password, attachments, children, and/or comments.

Below that, you can add a prefix or suffix to the title (e.g. “Copy of”) to denote that it is a duplicate.

You can then edit the resulting menu order and specify any meta fields you’d like excluded from the copy. You can also choose to omit taxonomy data such as categories or tags.

Permissions

Duplicate WordPress In Posts & Pages

On this tab, you can specify which user roles are allowed to duplicate posts, and you can add support for custom post types (as mentioned above).

Display

In this section, you can choose where you’d like the duplicate post links to show up.

Final Thoughts on How to Duplicate a Page in WordPress

Being able to duplicate a WordPress page or post with a single click is incredibly handy. It’s unfortunate that this feature isn’t available out of the box, but the Duplicate Post plugin is a seamless solution that works really well.

If you have any questions about duplicating content in WordPress, feel free to leave them in the comments below!

If you’re looking to duplicate a page in WordPress seamlessly and need fast WordPress hosting with done-for-you updates, check out our hosting packages by clicking the button below!

Brad Merrill
Author: Brad Merrill

Brad Merrill is the CEO of Merrill Media and Editor in Chief of GigaPress.

Subscribe
Notify me of
guest

0 Comments
Newest
Oldest Top Rated
Inline Feedbacks
View all comments

WordPress Masterclass: The Free Beginner Website Course

Learn how to build beautiful, functional websites without writing a single line of code. Completely free—no registration required.