Development

How to duplicate a page in WordPress: A beginner’s guide

Sometimes in life, you just need to clone something. Be it your favourite jumper, your favourite sandwich, or in the case of your WordPress site, a page that’s almost perfect but could use a tiny tweak. 

If you’ve ever wished for a duplicate page button on WordPress, then congrats, you’re not alone. The good news? It’s totally possible! And trust me, it’s way easier than you might think.

So, if you are eyeing to test local SEO strategies with some fresh content or just need a template to speed up your workflow, duplicating pages in WordPress is a trick every website owner should have up their sleeve. 

Let’s chunk down step by step, so you can become the ninja of page duplication without any of the techy stress.

Why Should Anyone Want to Duplicate a Page in WordPress?

Before the ‘how-to’, let’s chat about why you should bother duplicating a page in the first place. After all, isn’t every page unique and precious? Of course! But there are times when duplicating is just too handy to ignore. 

1. Time-Saving Superpower

Creating new pages from scratch is like a bit of a hassle, right? But with a duplicate, you basically copy your existing page, tweak a couple of things, and voilà! You’re done, and you didn’t even break a sweat. This is especially handy when you’re optimising a WordPress site for SEO.

2. Keep Things Consistent

If you like your pages looking neat and polished, duplicating is a lifesaver. You know the layout works, the text is solid, and the design looks great, no messy fonts or funky formatting to worry about.

3. A/B Testing Like a Pro

So you’ve got your page all set up, but now you’re wondering, “What if I change this headline?” Or “What if I use a different image?” A/B testing is your answer, and duplicating your page is the quickest way to do it. 

Test two different versions, compare the results, and let the numbers tell you which one wins. Pretty cool, right? Plus, if you’re into SEO and you’re hoping to win leads from Google, A/B testing will help your pages perform better and get noticed.

4. No Stress, All Experimentation

Want to try something new on your page, but don’t want to mess with your live one? That’s what duplicating is for! You can play around with different elements, new plugins, design changes, or even experiment with AI apps for businesses to improve content. And if it goes horribly wrong (don’t worry, it happens), just delete the duplicate and go back to your original. No harm done.

How to Duplicate a WordPress Page (Step-by-Step)

Now that you’re convinced about why duplicating a page is the way to go, let me tell you about how to actually do it. Don’t worry, I’ve got a couple of methods to suit you.

Option 1: Manually (For the Code Lovers)

Okay, this one’s for all who love a bit of coding. Don’t worry, it’s not as scary as it sounds. I’ll hold your hand through the whole thing.

Step 1: Backup Your Website (Always a Good Idea)

Before peeking into any changes, back up your site. You don’t want to mess with your WordPress website without a safety net. Try using tools like UpdraftPlus for a quick backup.

Step 2: Access Your Functions.php File

Here’s where we start getting a little techy. You’ll need to access your site’s functions.php file. Don’t freak out, this is easier than you think. The easiest way? FileZilla, seriously, it’s a lifesaver for FTP.

  • Once connected, go to /wp-content/themes/your-theme/.
  • Look for functions.php and open it. This is where we’ll add the code to allow page duplication.

Step 3: Add the Magic Code

Here comes the fun bit. Copy and paste this code into bottom your functions.php file:

function clone_post_as_draft() {
global $wpdb;
if (!isset($_GET[‘post’]) || !isset($_GET[‘duplicate_nonce’]) || !wp_verify_nonce($_GET[‘duplicate_nonce’], basename(__FILE__))) {
return;
}
$post_id = absint($_GET[‘post’]);
$original = get_post($post_id);
if (!$original) {
wp_die(‘Original content not found.’);
}
$current_user = wp_get_current_user();
$new_post = array(
‘post_title’ => $original->post_title,
‘post_content’ => $original->post_content,
‘post_status’ => ‘draft’,
‘post_type’ => $original->post_type,
‘post_author’ => $current_user->ID,
‘post_excerpt’ => $original->post_excerpt,
‘post_parent’ => $original->post_parent,
‘menu_order’ => $original->menu_order,
‘comment_status’=> $original->comment_status,
‘ping_status’ => $original->ping_status,
);
$new_post_id = wp_insert_post($new_post);
// Copy taxonomies
$taxonomies = get_object_taxonomies($original->post_type);
foreach ($taxonomies as $taxonomy) {
$terms = wp_get_object_terms($post_id, $taxonomy, [‘fields’ => ‘slugs’]);
wp_set_object_terms($new_post_id, $terms, $taxonomy, false);
}
// Copy post meta
$meta = $wpdb->get_results(“SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = $post_id”);
foreach ($meta as $meta_info) {
if ($meta_info->meta_key === ‘_wp_old_slug’) continue;
add_post_meta($new_post_id, $meta_info->meta_key, maybe_unserialize($meta_info->meta_value));
}
wp_redirect(admin_url(‘post.php?action=edit&post=’ . $new_post_id));
exit;
}
add_action(‘admin_action_clone_post_as_draft’, ‘clone_post_as_draft’);
function add_clone_link($actions, $post) {
if (current_user_can(‘edit_posts’)) {
$type_label = ($post->post_type === ‘page’) ? ‘Duplicate My Page’ : ‘Duplicate My Post’;
$url = wp_nonce_url(‘admin.php?action=clone_post_as_draft&post=’ . $post->ID, basename(__FILE__), ‘duplicate_nonce’);
$actions[‘clone’] = ‘<a href=”‘ . esc_url($url) . ‘” title=”Clone this item”>’ . $type_label . ‘</a>’;
}
return $actions;
}
add_filter(‘post_row_actions’, ‘add_clone_link’, 10, 2);
add_filter(‘page_row_actions’, ‘add_clone_link’, 10, 2);

Step 4: Time to Cheer

Code in? Check. Now go to Pages in your dashboard, hover over the page you want, and click “Duplicate as Draft.” Bingo! You’ve got a shiny new page ready for your edits.

Option 2: Through the Frontend (For the Non-Techies)

Not a fan of code? No problem! You can duplicate a page through the WordPress dashboard, and it’s super simple. Here’s how:

  • Head to your WordPress dashboard.
  • Click on “Pages” in the sidebar.
  • Hover over the page you want to copy and look for the “Copy” option.
  • Click “Copy” and boom! You now have a duplicate page ready to edit.

No coding required. It’s that easy!

Option 3: Through Plugins (For the Total No-Fuss Option)

If you’re not the type to mess with code, no worries! There are plenty of plugins that make duplicating pages a walk in the park. Here are my top three picks, tried and tested by many:

1. Duplicate Page and Post

Install this plugin, and you’ll get a “Duplicate” button next to your pages and posts. Click it, and you’re done. No hassle, no headaches. Simple and efficient.

2. Yoast Duplicate Post

Yoast is famous for SEO, but did you know it has a handy little duplication tool too? You can duplicate a page with just one click, and you even have the option to choose whether the duplicate is a draft or live. Easy peasy.

3. WP Staging

WP Staging isn’t just for duplicating single pages, it’s a full staging site solution. But hey, if you’re looking for a way to test a page before going live, this plugin lets you duplicate pages and check them in a staging environment first. It’s like a secret lab for your content.

Pitfalls to Avoid When Duplicating Pages

As with all good things in WordPress, there are a few things you’ll want to watch out for when duplicating pages. Trust me, the last thing you want is to end up with a site that’s a confusing mess of copies. Here are a few common pitfalls to avoid when duplicating your pages:

1. Duplicate Content is a No-No

One of the biggest headaches when duplicating pages is accidentally creating duplicate content (and no, Google doesn’t like that very much). To prevent penalties, make sure the duplicated page is either not indexed or has some unique content. One way to do this is by setting the new page as no-index in the page settings until you’re ready to launch it.

2. Not Updating Links

Make sure the URL of your new page is unique, otherwise, it might end up looking just like the original one. And don’t forget the links (both inside your site and external ones). Broken or old links are just asking for SEO trouble.

3. Don’t Wipe Out Your Original

Okay, this one’s easy to forget. You’re zooming through your edits, hit “publish” on the duplicate, and oops, you just nuked your original masterpiece. Keep the duplicate on its own, and your original will stay safe and sound.

Frequently asked questions

The most common questions we get asked.

Absolutely! No matter if it’s a landing page, a blog post, or a product page, you can duplicate just about anything. One needs this at any cost, when doing website development or managing multiple pages across WordPress development projects.

Not really! If the duplicates are for A/B testing or it’s got its own unique content, you’re golden. Just remember to play it safe, throw on no-index tags or 301 redirects where needed, and Google won’t even blink.

Nah, you don’t have to. You could get your hands dirty in functions.php and do it manually. But honestly? Using a plugin is way easier, less scary, and saves a bunch of headaches. If you’re a WordPress newbie, this is the way to go.

Sure thing! Got a cluster of blog posts or service pages that are similar? Go ahead and duplicate away. Just don’t overdo it, or Google might get a little confused with all the repeated content.

Written by Elaine Halliburton

Elaine Halliburton is a seasoned content creator. With a focus on web design, development, and marketing insights, Elaine crafts engaging and informative content to help businesses navigate the ever-evolving digital landscape.