How to Duplicate a Page/Post in WordPress (Screenshots)

Manually copying a blog post that is five thousand words long can be frustrating. Duplicating it in a few seconds can help us save our precious time.

In this post, we are going to look at some of the most effective ways to duplicate any page or post you want. I’ll share information about which plugin to use and how can you do it manually using your cPanel/FTP.

So without wasting any more time, let’s begin!

1. Plugin Method

Using a plugin is the easiest way to duplicate your content. It doesn’t require much effort. You can choose any of the plugins shown below, they all can help you in duplicating your post or page. However, if you know how to website edit files using FTP or cPanel, then you should go for the manual method because a manual method is always better than installing a plugin.

Too many plugins can significantly slow down your website, and a slow website affects revenue. However, I’ve selected 10 plugins for you, and I have arranged them from best to worst.

(A) Yoast Duplicate Post (Recommended)

Yoast is famous for its SEO plugin, but they also have Yoast Duplicate Posts plugin which is also quite popular. In fact, if you search “duplicate post” in the Plugins section, you’ll see this plugin at number one position, and there is a reason behind it.

This plugin has over 4 Million active installations, which is insane. It is one of the most popular plugins as well.

How to use Yoast Duplicate Post

Using Yoast Duplicate Post is quite easy. After successful installation, go to Settings and click Duplicate Post.

In What To Copy:

You can leave everything as is, or add Tittle Prefix if you want. The Tittle Prefix can let you know which post is a copied version and which isn’t.

Click Save Changes.

In Permission and Display, everything is ideal. Now, go to Posts and click on the Clone Button under the post you want to clone.

The cloning option is also available in the right side widget under Publish.

Furthermore, if you want to know more about Rewrite & Republish works then check out this video:

As I said, it is quite easy to set up. I recommend this plugin because of two reasons, first, you can trust it, and second, it receives updates. Additionally, it is a lightweight plugin so it won’t consume too many server resources.

(B) Duplicate Post

I found this plugin, well designed, easy to use, and lightweight. If you don’t wanna install Yoast Duplicate Post because of some reason, then install Duplicate Post, it is a great plugin.

Here are the features of this plugin as per the developer:

  • Duplicate pages to create short work of using again the exact elements you often use (e.g. text paragraphs, images, video, featured image, etc.)
  • Make a variation of a page or post fast to adjust it and compare side by side (for yourself, your customer, or company)
  • Create one excellent set of page templates and then re-use them for other projects, clients, or products
  • Use a facelift to a specific page but maintain the older version in case you like to switch back to it anytime
  • Create a “holiday special” page template and utilize it for different holidays with separate adjustments
  • Create duplicates for pages utilized in page builders with their custom settings

How To Use Duplicate Post

The plugin is available for free. Just go to the Plugins action of your WordPress and search “Duplicate Post”

Click Install and then Activate once you find it.

After successful installation, the plugin will ask you to allow data collection, you can skip it, or allow it if you wanna help the developer.

Copy-Delete-Posts-Allow-Data-Collection

You’ll see really cool animations:

Just click on Got it, close intro!

Now, go to your posts, and click Copy to duplicate any post or page you want.

Once you click on copy, it will take a few seconds, and the article will b copied. A new draft will be visible to you. Also, you may see a message like this:

Simply, click on No, I don’t want to help you to improve the plugin. Or, click on the Close button available at the top right corner to close it.

(C) Duplicate Post Page Menu & Custom Post Type

A very simple plugin with not so simple features. This plugin provides both free and paid services. It surprised me with so many options, especially, in the paid version. However, it has only 30,000 activated installations at the time of writing this post, that’s why I’ve placed it at number three.

More installations show trust. You should always check how many installations does the plugin has and what people are saying about it before actually installing it.

Less installed plugins are often ignored by their developers, and because of that, it becomes an easy target for hackers.

Here are some advantages of using Duplicate Post Page Menu & Custom Post Type plugin according to developer:

Features In Free Version

  • Duplicate Post, Page, Menu, and Custom Post Type more than once in one click.
  • Comfortable to configure for enabling/disabling specific post/page/custom post type/menu duplication.
  • Using Ajax for duplicating post/page/menu so no browser freezing in case of considerable data.

Features in Pro Editions

  • Duplicate Post, Page, Menu, and Custom Post Type for up to 100 duplicates in one single click.
  • Effortless to configure for enabling/disabling specific post/page/custom post type/menu duplication.
  • Using Ajax for duplicating post/page/menu to stop browser freezing in case of large data.
  • User Roles: Allow specific user roles to use the plugin.

How To Use it

After successful installation. Go to the post or pages, and click Duplicate, you can also enter how many duplicate posts you want which is another plus point.

Pic Credit  Inqsys Technology

(D) Duplicate Page

Last but not the least, Duplicate Page is another good plugin to copy posts and pages. Like all the above plugins, this plugin is also easy to use. And, the process of setting it up is also similar.

Some might be thinking why it has so many installations (2 million installations), it is because it was one of the earlier Duplicate plugins, so it got the attention of the bloggers and it became quite popular.

How To Use

Like I said, setting it up is similar to the above plugins. Just install and activate it from the plugins section. Once the plugin is installed, go to the posts and click “Clone This” under the post you wanna clone.

How To Clone Posts Pages Without Plugins (Coding Method)

Plugins increase server response time. Having too many plugins can make your site slow, so using the coding method is a really good option. However, I don’t recommend this method to beginners because you might mess up. Go with the plugin method if you don’t have any idea about how it works.

Now, follow the steps below to get the clone option without a plugin.

  • Login to your cPanel
  • Open File Manager
  • Open public_html
  • Open wp-content
  • Open themes folder
  • Click on the current theme folder
  • Edit functions.php
/**
 * @snippet  Duplicate posts and pages without plugins
 * @author   Misha Rudrastyh
 * @url      https://rudrastyh.com/wordpress/duplicate-post.html
 */

// Add the duplicate link to action list for post_row_actions
// for "post" and custom post types
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );
// for "page" post type
add_filter( 'page_row_actions', 'rd_duplicate_post_link', 10, 2 );


function rd_duplicate_post_link( $actions, $post ) {

	if( ! current_user_can( 'edit_posts' ) ) {
		return $actions;
	}

	$url = wp_nonce_url(
		add_query_arg(
			array(
				'action' => 'rd_duplicate_post_as_draft',
				'post' => $post->ID,
			),
			'admin.php'
		),
		basename(__FILE__),
		'duplicate_nonce'
	);

	$actions[ 'duplicate' ] = '<a href="' . $url . '" title="Duplicate this item" rel="permalink">Duplicate</a>';

	return $actions;
}

/*
 * Function creates post duplicate as a draft and redirects then to the edit post screen
 */
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );

function rd_duplicate_post_as_draft(){

	// check if post ID has been provided and action
	if ( empty( $_GET[ 'post' ] ) ) {
		wp_die( 'No post to duplicate has been provided!' );
	}

	// Nonce verification
	if ( ! isset( $_GET[ 'duplicate_nonce' ] ) || ! wp_verify_nonce( $_GET[ 'duplicate_nonce' ], basename( __FILE__ ) ) ) {
		return;
	}

	// Get the original post id
	$post_id = absint( $_GET[ 'post' ] );

	// And all the original post data then
	$post = get_post( $post_id );

	/*
	 * if you don't want current user to be the new post author,
	 * then change next couple of lines to this: $new_post_author = $post->post_author;
	 */
	$current_user = wp_get_current_user();
	$new_post_author = $current_user->ID;

	// if post data exists (I am sure it is, but just in a case), create the post duplicate
	if ( $post ) {

		// 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 new post draft
		 */
		$taxonomies = get_object_taxonomies( get_post_type( $post ) ); // returns array of taxonomy names for post type, ex array("category", "post_tag");
		if( $taxonomies ) {
			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 post meta
		$post_meta = get_post_meta( $post_id );
		if( $post_meta ) {

			foreach ( $post_meta as $meta_key => $meta_values ) {

				if( '_wp_old_slug' == $meta_key ) { // do nothing for this meta key
					continue;
				}

				foreach ( $meta_values as $meta_value ) {
					add_post_meta( $new_post_id, $meta_key, $meta_value );
				}
			}
		}

		// finally, redirect to the edit post screen for the new draft
		// wp_safe_redirect(
		// 	add_query_arg(
		// 		array(
		// 			'action' => 'edit',
		// 			'post' => $new_post_id
		// 		),
		// 		admin_url( 'post.php' )
		// 	)
		// );
		// exit;
		// or we can redirect to all posts with a message
		wp_safe_redirect(
			add_query_arg(
				array(
					'post_type' => ( 'post' !== get_post_type( $post ) ? get_post_type( $post ) : false ),
					'saved' => 'post_duplication_created' // just a custom slug here
				),
				admin_url( 'edit.php' )
			)
		);
		exit;

	} else {
		wp_die( 'Post creation failed, could not find original post.' );
	}

}

/*
 * In case we decided to add admin notices
 */
add_action( 'admin_notices', 'rudr_duplication_admin_notice' );

function rudr_duplication_admin_notice() {

	// Get the current screen
	$screen = get_current_screen();

	if ( 'edit' !== $screen->base ) {
		return;
	}

    //Checks if settings updated
    if ( isset( $_GET[ 'saved' ] ) && 'post_duplication_created' == $_GET[ 'saved' ] ) {

		 echo '<div class="notice notice-success is-dismissible"><p>Post copy created.</p></div>';
		 
    }
}

And now some comments about this code:

  • If you’re curious only about how to duplicate a page in WordPress without a plugin, it is sufficient for you to use page_row_actions filter hook (line 11), if you’re curious about duplicating posts and custom post types, post_row_actions is for you (line 9).
  • In the code you can also see some safety checks, I am using Nonces and clean $_GET[ 'post' ] with absint() function.
  • In lines 71-85 you can adjust post data for your needs. For example, we clone posts as drafts, but you can put a publish post status, which you shouldn’t do because you must check the post before directly publishing it.
  • In lines 107-109 we stop copying meta with key _wp_old_slug, it is essential to prevent redirects.

I hope this post was helpful!

Checkout Similar Posts

How To Disable (Remove) Sidebars (Screenshots) 5 ways

How to Fix The Theme Is Missing The Style.CSS Stylesheet Error (Screenshots)

How to Get Sticky (Floating) Sidebar 5 Smart Ways

WordPress Sidebar Missing Fixed (4 Reason)

Sumit
Sumit

Sumit is a regular contributor to Hostinggrow.com. He has 6 years of experience in blogging, and he loves football, his favorite player is - Lionel Messi (GOAT), but he has no hate for Ronaldo.

Articles: 62

Leave a Reply

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