Duplicate Posts and Pages in WordPress

8 min read

How To Duplicate Posts and Pages in WordPress ? Full Review

There are many situations in which it may be necessary to duplicate a WordPress post or page. You may want to use a particular layout for a new page on your WordPress site or you may need duplicate posts to update your content. In WordPress, a page or post can be duplicated. This involves more than just copying and pasting content. You can keep the page template, SEO information, images, and other information when updating or redesigning your website to save time and effort. In WordPress, duplicate pages, posts, and all related data are simple to create.

Using or not using a plugin is up to you. This article will demonstrate safe page or post cloning techniques and introduce some plugins that might be useful. Start the process now! Fortunately, WordPress makes it simple to duplicate pages, posts, and any associated data.

Both with and without a plugin, there are straightforward ways to complete the task. In WordPress, if you need to save things like design, comments, metadata, or SEO settings, you must duplicate the post and page. I’ll go into detail about how to do it in this article.

You might be considering manually copying and pasting a duplicate of your WordPress post or page. Additionally, WordPress’s block editor now has a ‘copy all content’ option. This process is not ideal for copying pages and posts, though. You only copy the text of your content when you manually duplicate a post or page in WordPress. You will therefore need to duplicate your page template, images, and SEO components like meta descriptions and title tags separately.
If you have many WordPress posts, pages, or custom post types to duplicate, the process won’t just take a long time; it’ll also be frustrating. Duplicating a page or a post can also lower your ranking in search results. The need to duplicate your content and use it as a model for a new post or page on your WordPress website does arise occasionally, though. Thankfully, a post duplication plugin can make it simple to duplicate pages or posts without having to worry about making mistakes. See our list of the top WordPress plugins to duplicate posts, pages, and custom post types. We’ll also demonstrate how to use them:

1. Duplicate Post

Duplicate Posts and Pages in WordPress

Duplicate Post is a well-liked choice for WordPress web page or post cloning. The plugin is straightforward to make use of and copies the whole lot, from the post or web page content material to the feedback. You also can select to make use of a prefix or suffix to tell apart between the unique post and the clone.

Related Post  How To Create A PopUp In WordPress

You can simply duplicate a post utilizing this tool by merely:

  1. Install the plugin and activate it.
  2. Go to Posts > All for cloning posts or pages > For cloning pages.
  3. To copy the web page or post that you’re on the lookout for, navigate to it and click on Clone.
  4. You can choose a number of pages or posts and you may clone all of them directly with Bulk actions.

2. Duplicate Page

Duplicate Posts and Pages in WordPress

Duplicate Page has just a few additional features that different cloning software program would not provide. This plugin can duplicate pages, posts, and customized post sorts. You also can save the ensuing copies in drafts as pending, public, and personal.

You can simply duplicate a post utilizing this tool by merely:

  1. Install the plugin and activate it.
  2. You can customise the settings to fit your wants.
  3. To discover the content material that you’re on the lookout for, go to pages > All and Posts > all.
  4. Click on the Copy This possibility.

3. Duplicate Page and Post

Duplicate Page and Post would not have many features but it surely makes up for this in speed. This plugin is light-weight and quick. It will not decelerate your website with too many choices.

You can simply duplicate a post utilizing this tool by merely:

  1. Install the plugin and activate it.
  2. You can discover the Posts All and Pages All relying on what you are attempting to duplicate.
  3. Click on the web page or post that you just want to clone.
  4. Click on the Duplicate button.

4. Post Duplicator

Duplicate Posts and Pages in WordPress

Another easy cloning plugin is Post Duplicator. This answer creates a precise duplicate of any post or web page, together with customized post varieties, customized fields, and customized taxonomies. It’s fast and easy to make use of, and shouldn’t add a lot weight to your website. To duplicate content material with this tool, comply with these steps:

  1. Install the plugin and activate it.
  2. Navigate to Posts > All or Pages > All to search out the content material you need to clone.
  3. Hover over the post or web page.
  4. Click on the Duplicate Page or Duplicate Post choice.

Duplicate Page in WordPress without Plugins

To clone a WordPress web page or post, you don’t want to make use of a plugin. You also can do that manually by editing the features.php file, or copying and pasting related code. Let’s check out each of those strategies.

Enabling Cloning through features.php

Editing the code in your operate.php file is one option to clone WordPress pages or posts. Although this can be a easy process, you should watch out and create a backup copy of your web site earlier than doing so. You might want to entry the features.php folder and open it for editing. You will then want so as to add this code snippet on the finish of your file.

/*
 * Function for post duplication. Dups appear as drafts. 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;
 
  /*
   * get the original post id
   */
  $post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
  /*
   * and all the original post data then
   */
  $post = get_post( $post_id );
 
  /*
   * if you do not need present consumer to be the brand new post writer,
   * then change subsequent couple of strains to this: $new_post_author = $post->post_author;
   */
  $current_user = wp_get_current_user();
  $new_post_author = $current_user->ID;
 
  /*
   * if post knowledge exists, create the post duplicate
   */
  if (isset( $post ) && $post != null) {
 
    /*
     * 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 by wp_insert_post() function
     */
    $new_post_id = wp_insert_post( $args );
 
    /*
     * get all current post terms ad set them to the brand new post 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) 
 
    /*
     * duplicate all post meta simply in two SQL queries
     */
    $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) 
      $sql_query.= implode(" UNION ALL ", $sql_query_sel);
      $wpdb->query($sql_query);
    }
 
 
    /*
     * lastly, redirect to the edit post display screen for the brand new draft
     */
    wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
    exit;
  } else 
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
 
/*
 * Add the duplicate link to 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 );

 

Related Post  How To Migrate From Weebly To WordPress

That was only for posts to date. To have the ability to do the identical for pages, use the identical code as soon as once more in your features.php however change the final line (108) by:

 

FAQ.

How should a duplicate post or page be published?

like when you publish a new page or post. Click “Publish” after making any necessary edits to the duplicate. “.

What is the most trustworthy method for making copies of pages?

You can copy the content in one of three ways: through code, the Gutenberg editor, or a specialized plugin. You can duplicate pages using Elementor. Using plugins is the simplest way to accomplish this. Select the option that meets all of your requirements.

Can I edit a post or page that was duplicated?

Yes. After duplication, you can edit the post or page. It’s simple to duplicate pages in WordPress. Making a list of your priorities will help. to retain the text alone; to maintain the structure, design, and text; to store every element, including metadata.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge