ThimPressThimPress ThimPress
  • Themes
    • WordPress Theme
    • Shopify Theme
    • All Themes
  • Plugins
    • LearnPress
    • LearnPress Pro Bundle
    • LearnPress Semi-Pro Bundle
    • LearnPress Premium Add-ons
    • LearnPress Free Add-ons
    • LearnPress Mobile App
    • All Plugins
  • Blog
    • Best SEO Practice for Beginners
    • Internal link building tools
    • WordPress for Education
    • What are Sentiment Words
    • 20+ Free Shopify Themes
  • Coupons
  • Help Center
    • Support Forum
    • Ticket Center
    • Documentation
    • Knowledge Base
    • FAQs
    • Contact Us
  • Our Services
    • Customization
    • Maintainance
    • Hosting
    • Advertise
  • 0
  • Sign in
Back
  • Themes
    • WordPress Theme
    • Shopify Theme
    • All Themes
  • Plugins
    • LearnPress
    • LearnPress Pro Bundle
    • LearnPress Semi-Pro Bundle
    • LearnPress Premium Add-ons
    • LearnPress Free Add-ons
    • LearnPress Mobile App
    • All Plugins
  • Blog
    • Best SEO Practice for Beginners
    • Internal link building tools
    • WordPress for Education
    • What are Sentiment Words
    • 20+ Free Shopify Themes
  • Coupons
  • Help Center
    • Support Forum
    • Ticket Center
    • Documentation
    • Knowledge Base
    • FAQs
    • Contact Us
  • Our Services
    • Customization
    • Maintainance
    • Hosting
    • Advertise
  • Home
  • Tutorials & Updates

WordPress Duplicate Page or Post: How to Do it

Tutorials & Updates - By Duke - December 6, 2022

Do you usually make WordPress Duplicate Page things on our site?

Duplicating a page or post is not something very common when you develop a website. However, it would be a smart move of you if you usually duplicate pages or posts.

Thus, do you need a testing field for a brand new layout? Or maybe for system updates and upgrades? No matter what the situation is, you can always make WordPress duplications by many methods. What you need to notice here is which methods will suit you and your site. In this article, we are very pleased to deliver you the tutorial to explain and guide how to duplicate a page in WordPress.

Before that, let’s get things up: why you should make page/post duplications.

Table of Contents

  • WordPress Duplicate Page: Do You Need It?
    • Manual Copying and Pasting the Content
      • Step 1: Make a Copy Version from the Original Source
      • Step 2: Delete Tags in the HTML
    • Duplicating Posts and Pages with Block Editor
    • Applying a Plugin in the WordPress Duplicate Page
    • Importing Code to the File functions.php
      • Access the FTP Clients
      • Add Code Lines
      • Finish the Process
    • Choosing the Rightful Ways for WordPress Duplicate Page
        • How to Duplicate a WordPress Page: Conclusion

WordPress Duplicate Page: Do You Need It?

Well, you can choose to do it or not. However, there are situations where you will need your site’s duplications, for instance:

– Users are working on the newest version of the theme, plugin, WordPress, PHP, or something related and your site doesn’t have the staging process.

– Want to make a copy to reuse when you make new content.

– You find a dream layout and you would like to try it on your site.

– Need to apply a custom CSS/HTML code to your new website.

As you can see, a duplicated version will bring into play enormous benefits. Well, let’s dip into the methods to duplicate page WordPress.

Manual Copying and Pasting the Content

Simply, you will copy and paste the content into a new version/draft. It looks very easy to approach and we can guess why you choose this method:

– You don’t know the faster method.

– Your site does not own many pages and does not focus on SEO.

– You are duplicating a page that is inaccessible through your site’s back end.

Read more:  How to Save Facebook Video to iPhone: Learn the Methods

For reasons 2 and 3, we have to agree that copying and pasting hand by hand become the best choice for all of you. Still, this method has some cons. You can’t copy pictures, meta tags, permalinks, custom CSS/HTML, and other elements correctly.

Here are 2 steps to do it:

Step 1: Make a Copy Version from the Original Source

Well, you can say that Ctrl+A will be the most important factor here. What you will do is get access to the planned site, highlighting, copying, and pasting it to your planned project.

Therefore, you will go straight for the content. Move to the next step.

Step 2: Delete Tags in the HTML

After pasting the content, navigate to your site’s code editor. In here, you will delete all &nbsp; and <span> Meta tags since your site will follow the framework of the code.

As has been said, duplicating manually may bring you potential bugs and errors. To solve this, you may look up other resolutions that still maintain our site.

Duplicating Posts and Pages with Block Editor

Particularly, duplicating with the Block Editor seems semi-manual but it still has almost the same disadvantages as manual duplicating.

You may begin by opening the website and selecting “More tools & choices” from the menu in the upper right corner. Choose “Tools” and “Copy all contents” after that. After pasting everything into the designated section, you will then have all of the material for the new project.

Applying a Plugin in the WordPress Duplicate Page

Generally, you can do anything in WordPress with plugins and so does page duplications.

First, you will select the suitable plugins: updated within the last 6 months, rated at least 4/5 stars, and can integrate with your WordPress version. Let’s take the Duplicate Page plugin as an example.

Then, you will download and activate it. Navigate to “Pages” -> “All pages”, move to the planned site, and choose the “Duplicate this” button. Well done, you can duplicate a page in WordPress with plugins from now.

Importing Code to the File functions.php

People often say “The tougher the solution is, the more flexible and efficient the result will come out”. On the other hand, this answer fits with this saying as well. Users may add code to the functions.php file to accomplish a variety of goals in addition to duplicating a WordPress page. You might provide a link on the dashboard tab to make things easier. So, creating a WordPress clone page will be quite simple for you.

Read more:  What is Post Slug in WordPress?

Let’s settle down some requirements first:

– Your site’s server accessibility: You can always find the references in the host management panel or in an email sent to you when buying an account for the 1st time.

– A child theme coming from the current parent theme: You can save changes when updating/upgrading the site. Also, your site should have a child theme.

– A text editor: You should choose the suitable one for your purposes.

– A FTP client: Users may access the FTP client in the hosting’s file manager. Besides, you can also use other implements.

Access the FTP Clients

First of all, access the FTP client and navigate to the folder “wp-content” -> “theme”. Thus, you should have the file functions.php in the child theme’s folder. If not, make one first.

Add Code Lines

Afterward, open that file. In there, you will add the below code lines:

/* Duplicate posts and pages function. Duplicates appear as drafts, and the 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; /* This gets the original post or page ID */ $post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) ); /* …then grabs the original post data. */ $post = get_post( $post_id ); /* To select another user as the post author, use $new_post_author = $post->post_author;. Otherwise… */ $current_user = wp_get_current_user(); $new_post_author = $current_user->ID; /* If the post data exists, create the duplicate */ if (isset( $post ) && $post != null) { /* Create a 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 using wp_insert_post() */ $new_post_id = wp_insert_post( $args ); /* Get all current post terms, then set them against the new 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 of the post metadata */ $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); } /* 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 the 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 ); add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);

Finish the Process

Lastly, reload and get back to the screen “Pages”. On that screen, you should observe the link of duplicating on this page. Furthermore, you can use this as a plugin and develop it for later uses.

Read more:  WordPress Theme Detector: The Best Collection

Therefore, that’s how to duplicate page in WordPress with a plugin.

Choosing the Rightful Ways for WordPress Duplicate Page

You may think that it’s quite easy to copy page WordPress. Besides, people tend to choose the best and fastest ways to get it done. However, we suggest you should choose a more complex and detailed method based on your demands.

Therefore, using a plugin is the best option for those who only need to copy a WordPress page. When you download and install your theme, it will go into action and provide all features for all associated issues. The hardcoding approach could be a good option, though, if you want to produce a lot of copies. On the other hand, if it’s possible, you can pursue different options for certain reasons and objectives. Hence, if it fully helps you, it will be worth your budget.

How to Duplicate a WordPress Page: Conclusion

Going at the situation, creating a WordPress duplicate page should be simple for any site developer or owner. Each person has a variety of options depending on the requirements and level of experience. After reading this guide, you should know how to clone a WordPress post or page using 4 popular techniques. Their challenges range in complexity from the most basic to the most advanced.

Through the article, we believe you would have obtained the rightful solution to duplicate a WordPress page.

Read more: How to Create a WordPress Child Theme.

TAGS: WordPresswordpress guidewordpress plugin
  • Share
  • Facebook
Duke
ThimPress content writer, customer support, SEO learner, and on-page advertisement manager. Wanna feature your site on ThimPress? Contact me via email [email protected]. Cheer!

Related Articles

Best WordPress Development Agencies

Best WordPress Development Agency Review: The Top 8 Agencies You Should Consider for Your Project

Best Multi Currency WordPress Plugins

Why Use A Multi Currency WordPress Plugin to Boost Your Sales? Top 7 Picks

WordPress White Screen of Death

WordPress White Screen of Death: Clear Guide & Tips

Google Meet vs. Zoom Which is Better

Google Meet vs. Zoom: Which Is Better for Your Business?

Remove the Date From Your WordPress URLs

Remove the Date from Your WordPress URLs: Complete Guide

Latest Articles

  • How Much Does Magento Cost?

    Magento Pricing: How Much Does It Cost to Run a Magento Store?

  • Best WordPress Development Agencies

    Best WordPress Development Agency Review: The Top 8 Agencies You Should Consider for Your Project

  • Best Multi Currency WordPress Plugins

    Why Use A Multi Currency WordPress Plugin to Boost Your Sales? Top 7 Picks

  • The Best Ways to SEO with Images

    10+ Best Ways to SEO with Images (Detail Guide)

  • WordPress White Screen of Death

    WordPress White Screen of Death: Clear Guide & Tips

Categories

  • Blog
  • Tutorials & Updates
  • Marketing & SEO
  • WordPress Theme Collections
  • Glossary
thimpress logo

We are a company that is passionate about developing products to help you build your business online. Our very first priority is to guarantee our customers’ experience and satisfaction.

"ThimPress" is a brand of "PhysCode LLC".
Address: 14936 DILLOW ST, #V301, Westminster, CA 92683.
Email: [email protected]


COMPANY

  • Privacy Policy
  • Terms & Conditions
  • Refund Policy
  • Item Support Policy
  • Partner
  • Advertise

AFFILIATE

  • Become an Affiliate
  • Affiliate Terms & Policies

SUPPORT

  • Documentation
  • Forum
  • How to get help

PRODUCT

  • WordPress Plugins
  • WordPress Themes
  • Shopify Themes
  • Coupon

Our Network

  • Facebook
  • Twitter
  • Envato
  • Youtube
  • PhysCode
  • ArrowTheme

Special offer promotion

Up To 40% OFF
ThimPress Products
Sale ends October 15, 2023
Show me more
Designed by ThimPress. Powered by WordPress.
DMCA.com Protection Status
  • Terms & Conditions
  • Documentation

Sign In

Lost your password?

Not a member yet? Sign up now

Lost Password

Please enter your username or email address. You will receive a link to create a new password via email.

Are you a member? Sign in now