Are you tired of copying and pasting content whenever you need to create a similar post or page in WordPress? It can take a lot of time and often leads to mistakes and inconsistencies on your website. Whether you’re running a blog website, an online store, or any other type of site, manually handling duplicate content can be frustrating and inefficient.
Imagine if you could duplicate your WordPress posts and pages with a few clicks without copying and pasting content manually. WordPress has easy solutions for quickly and accurately copying posts and pages. With the right choice, you can clone your content in a few simple steps, saving time and reducing errors.
In this article, we’ll show you the manual and plugin methods for duplicate posts and pages in WordPress so you can keep your website running smoothly and focus on what really matters.
Why You Need to Duplicate WordPress Posts & Pages
Duplicating WordPress posts and pages is a great way to save time and effort when managing your website. Instead of starting from scratch every time you need a similar post or page, you can easily make a copy and modify the details you need to change. This maintains content consistency and streamlines your workflow, allowing you to focus on more important tasks.
By duplicating posts and pages, you can also reduce the chance of making mistakes that can happen when copying content manually. It’s a simple and effective way to maintain a professional look across your website. With the correct method, duplicating content can be done in just a few clicks, making it easier to focus on creating new and engaging content for your audience.
Ways to Duplicate WordPress Posts & Pages
Here are several methods to duplicate posts and pages in WordPress, each catering to different needs. We’ll cover both manual and plugin methods for duplicating content in WordPress.
Manual Method For Duplicating Content
The manual method of duplicating content in WordPress involves copying the entire text and images from an existing post or page and pasting them into a new draft. This method is straightforward but can be time-consuming, especially for posts with lots of content or complex layouts.
Using HTML Code
If you are using a Block Editor, then you can duplicate content using HTML code by copying and pasting the HTML structure of a web page or a specific section within it. This method involves manually copying the HTML code from one page and inserting it into another, allowing you to replicate content across different parts of your website. Here is how you can do it:
- Edit the post or page you want to duplicate.
- Click on “Options” and select “Code Editor“.
- Next, copy the HTML code displayed on the page.
Insert Copied Code to Pages & Posts
To insert the copied code into any WordPress post or page, follow these steps:
- Create a new page or post.
- Again, navigate to “Options” and choose “Code Editor.”
- Paste the copied HTML code into the editor.
- Switch back to the Visual Editor to view and edit the duplicated content as needed.
After pasting the HTML code and switching to the visual editor, you’ll notice that the content from the original post has been copied into the current post, effectively duplicating your content. This method allows you to replicate content easily across different posts on your website.
Using Gutenberg Editor
Duplicating content using the Gutenberg editor in WordPress is straightforward. This method helps you quickly copy the layout and content of your posts and pages. It is beneficial when you need to replicate complex designs or want to maintain consistency across multiple pieces of content.
To use this method, follow these steps:
- Open the post or page you wish to duplicate.
- Click on the “Options” menu (three vertical dots) and choose “Copy all Blocks.”
- Create a new post or page.
- Paste the copied content by pressing
Ctrl + V
, or right-click on a blank area and select “Paste.”
Utilizing functions.php File
Another way to duplicate WordPress pages and posts is by editing the functions.php File of your child theme. This method involves adding code to this file to create a duplicate option.
Here’s how you can use it:
- First, find the
functions.php
File in your current theme. It is located in your child theme’s folder under/wp-content/themes/your-theme-name/
. - Next, copy the code provided below into the
functions.php
File. This code will add the option to duplicate posts.
// Functions to Clone a WordPress post as a draft
function clone_post_as_draft(){
global $wpdb;
// Check if a post ID is provided and if the action is 'clone_post_as_draft'
if ( ! ( isset( $_GET['post_id'] ) || isset( $_POST['post_id'] ) || ( isset($_REQUEST['action']) && 'clone_post_as_draft' == $_REQUEST['action'] ) ) ) {
wp_die('No post specified for duplication!');
}
// Security check for nonce verification
if ( !isset( $_GET['clone_nonce'] ) || !wp_verify_nonce( $_GET['clone_nonce'], basename( __FILE__ ) ) ) {
return;
}
// Retrieve the original post ID
$original_post_id = ( isset($_GET['post_id']) ? absint( $_GET['post_id'] ) : absint( $_POST['post_id'] ) );
// Fetch the original post details
$original_post = get_post( $original_post_id );
// Get current user ID to assign as the new post author
$current_user = wp_get_current_user();
$new_post_author_id = $current_user->ID;
// If the original post exists, create a duplicate
if ( isset( $original_post ) && $original_post != null ) {
// Array containing a new post data
$post_data = array(
'comment_status' => $original_post->comment_status,
'ping_status' => $original_post->ping_status,
'post_author' => $new_post_author_id,
'post_content' => $original_post->post_content,
'post_excerpt' => $original_post->post_excerpt,
'post_name' => $original_post->post_name,
'post_parent' => $original_post->post_parent,
'post_password' => $original_post->post_password,
'post_status' => 'draft',
'post_title' => $original_post->post_title,
'post_type' => $original_post->post_type,
'to_ping' => $original_post->to_ping,
'menu_order' => $original_post->menu_order
);
// Insert the cloned post into the database
$new_post_id = wp_insert_post( $post_data );
// Copy all current post terms (categories, tags) to the new draft
$taxonomies = get_object_taxonomies($original_post->post_type);
foreach ( $taxonomies as $taxonomy ) {
$terms = wp_get_object_terms($original_post_id, $taxonomy, array('fields' => 'slugs'));
wp_set_object_terms($new_post_id, $terms, $taxonomy, false);
}
// Duplicate post meta data in a single query
$meta_data = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$original_post_id");
if ( count($meta_data) != 0 ) {
$query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
$query_parts = array();
foreach ( $meta_data as $data ) {
$key = $data->meta_key;
if( $key == '_wp_old_slug' ) continue;
$value = addslashes($data->meta_value);
$query_parts[] = "SELECT $new_post_id, '$key', '$value'";
}
$query .= implode(" UNION ALL ", $query_parts);
$wpdb->query($query);
}
// Redirect to the edit screen for the new draft
wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
exit;
} else {
wp_die('Failed to duplicate post. Original post not found: ' . $original_post_id);
}
}
add_action( 'admin_action_clone_post_as_draft', 'clone_post_as_draft' );
// Add a clone link to post row actions in the admin panel
function add_clone_post_link( $actions, $post ) {
if (current_user_can('edit_posts')) {
$actions['clone'] = '<a href="' . wp_nonce_url('admin.php?action=clone_post_as_draft&post_id=' . $post->ID, basename(__FILE__), 'clone_nonce' ) . '" title="Clone this post" rel="permalink">Clone</a>';
}
return $actions;
}
add_filter( 'post_row_actions', 'add_clone_post_link', 10, 2 );
To enable the duplicate option for pages, you can use the same code provided earlier. But replace the last line of code as follows:
add_filter( 'page_row_actions', 'add_clone_post_link', 10, 2 );
After saving the file, refresh your WordPress admin dashboard. Then, go to your Posts or Pages section. You’ll notice a new “Duplicate” option when you hover over any posts or pages.
Duplicate Content Using Plugins
Duplicating posts and pages in WordPress can be effortlessly done using plugins, making it one of the simplest methods available. These plugins provide convenient options to replicate content on your website with just a few clicks. Here’s a look at some popular plugins developed for this purpose:
Yoast Duplicate Post
This plugin allows you to clone posts and pages directly from your WordPress dashboard. It preserves all content, including text, images, and metadata, making it easy to create duplicates without altering the original content.
To begin using the Yoast Duplicate Post plugin, first install and activate it on your website. Once installed, follow these steps to duplicate your content using the plugin.
- Navigate to Posts ➝ All Posts to duplicate a post, or Pages ➝ All Pages to duplicate a page.
- Here, you need to hover over the original page or post you want to duplicate. You will see three options to select from:
- Clone: Makes an exact copy of the particular post or page.
- New Draft: Duplicates the post or page and opens it in the content editor for editing.
- Rewrite & Republish: This process duplicates the post or page and opens it in the editor. You can make changes and click “Republish” in the Gutenberg editor, which updates the original post with the new content.
You can also duplicate multiple posts or pages at once. Select the posts or pages you want by checking the boxes beside their titles.
Then, click on “Bulk Actions” and choose either “Clone” or “Rewrite & Republish” from the dropdown menu.
Finally, click “Apply” to duplicate all the selected posts or pages in one go. This method efficiently manages multiple duplications quickly and easily on your WordPress site.
Configure Yoast Duplicate Post Plugin Settings
This plugin duplicates pages and posts in WordPress by default. You can also set it up to duplicate custom post types or adjust which elements get copied during duplication. It means you can change the default settings of the Yoast duplicate plugin by configuring its settings.
- To do this, navigate to WordPress Dashboard ➝ Settings ➝ Duplicate Post.
Here, you will find the three sections: What to Copy, Permissions, and Display.
In the first section, you can choose what elements of the post or page to copy using Yoast Duplicate Post. It includes elements like the title, date, excerpt, content, and more. Check or uncheck the elements you want to copy. You can also adjust other available settings here.
In the permissions tab, Admins and Editors can duplicate content by default, but you can change who can duplicate based on their role. You can also select which custom post types to copy. If you use WooCommerce, you can duplicate content for Coupons and Orders, too.
Next, In the Display section, you can choose which duplicate links appear in your WordPress dashboard: clone, rewrite & republish, and new draft. Just check or uncheck the boxes for the links you want to show. You can also select where these duplicate links appear—on the post list, edit screen, admin bar, and bulk actions —by checking or unchecking boxes in the ‘Show links in’ section.
Plugins to Duplicate Posts & Pages in WordPress
You can also use other plugins to duplicate posts and pages in WordPress. Some additional plugins include:
Duplicate an Elementor’s Page & Post in WordPress
Duplicating pages and posts created with Elementor in WordPress can save time and effort, especially when you want to create similar layouts or content structures. Here’s how you can easily duplicate Elementor pages and posts:
- Go to the page or post you wish to duplicate in your WordPress dashboard and open it with Elementor.
- Scroll down the page and look for the arrow with an update button on the left.
- Click on the arrow, Choose “Save as Template,” and give your template a name.
- Then, save your template by clicking on the Save button.
Insert Saved Template to Posts & Pages
Once you’ve saved your post or page as a template, here’s how you can easily add that template to any other post or page:
- Start by making a new page or post in WordPress, and open it with Elementor.
- Click on the folder icon on your screen to open the Elementor library.
- Go to the “My Templates” section and select your desired template.
- Then, click the “Insert” button to add a template to your page or post.
Duplicate Your WordPress Posts & Pages Efficiently
Duplicating pages and posts is a great way to save time and effort. If you need to duplicate just one post, doing it manually can work well. However, duplicating multiple posts or pages makes using a plugin easier and safer. It helps avoid mistakes and makes duplicating content across your site much more straightforward. Above, we covered manual and plugin methods for duplicating content, providing flexible solutions to streamline your workflow.