You can easily duplicate a page in WordPress by using these Plugins.
Cloning a page on WordPress is easy using the WordPress plugin, as everything happens on your dashboard. They are the best method to duplicate a post or page, as you’re not altering the code on your site directly.
If you’re in search of the best instrument, Here are four plugins worth looking into.
Duplicate PostOne of the top alternatives when it comes to WordPress blog and page copying is Duplicate Post. This well-known plugin is simple to use and copies everything from the content of your post or page to the related comments. The plugin also comes with an option to prefix or add suffixes to distinguish between the original post and the copy.
To duplicate an existing WordPress post using this program, only must:
- Install and then activate the plugin and then activate it.
- On Your WordPress dashboard, navigate to Posts >> All when cloning posts, or Pages All when you clone posts, as well as Pages > All when you are cloning pages.
- Go to the page or article you want to copy and then click Clone for the option to duplicate it.
- Multiple pages or posts may be chosen, and you can even clone them all at once with bulk actions.
- Duplicate Page and Post
Duplicate Post and Page doesn’t have many options. It does make up for it in speed. This plugin for the same posts that is lightweight is among the quickest methods to duplicate pages or posts within WordPress and will not burden your website by requiring unnecessary bells and bells.
To duplicate the content of a post or page with this plugin, follow the steps below:
- Install and then activate the plugin and then activate it.
- Visit the Posts >> All All or Pages > All, depending on the type of post you’re looking to duplicate.
- Move your cursor over the page or post that you would like to copy.
- Choose”Duplicate” to access the duplicate option.
- Duplicate Page
Duplicate Pages provides a number of additional options that other cloning plugins do not offer. The plugin can duplicate pages, posts, as custom post types. Additionally, you can keep the copies you create as drafts or pending, public or private.
To make use of a Duplicate Page, you simply must:
- Install and then activate the plugin and then activate it.
- Adjust its settings to suit your requirements.
- Click on Pages > All or Posts > All to locate the content you wish to duplicate.
- Select the Duplicate option. Option.
- Post Duplicator
Another easy cloning tool can be found in Post Duplicator. It creates a precise duplicate of every page or post and includes customized post types, fields, and taxonomies that are custom. It’s easy and quick to use and won’t be a burden to your website.
To duplicate content using this tool to copy content, follow these steps:
- Install the plugin, and then activate it.
- Browse to Pages All or Pages All (or Pages > All to locate the content you’d like to copy.
- Click on the page or post.
- Choose to select the Duplicate Pages option or Duplicate Post option.
Duplicating a Page in WordPress Without a Plugin
Of course, there is no need to install a plugin in order to duplicate the content of a post or page in WordPress. It can be done manually, by either changing the funtions.php file or by copying and pasting relevant code. Let’s take a look at how each method works.
- Enable Cloning through funtions.php Code
One method to duplicate an existing WordPress article or webpage is to modify the code within the functions.php file. Although this is a simple thing to achieve, you need to be extra cautious and create an archive of your site first.
To allow cloning of posts, you’ll need open the functions.php file and open it to edit by using Secure File Transfer Protocol (FTP) or whatever alternative method you’d like to use. After that, you’ll have to include this code in a snippet on the last line of your file.
/*
* Function to perform post duplication. Dups appear as drafts. Users are redirected to 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 duplicated post is available! ‘);
}
/*
* Nonce verification
*/
if ( !isset( $_GET[‘duplicate_nonce’] ) || !wp_verify_nonce( $_GET[‘duplicate_nonce’], basename( __FILE__ ) ) )
return;
/*
* Get the post’s ID
*/
$post_id = (isset($_GET[‘post’]) ? absint( $_GET[‘post’] ) : absint( $_POST[‘post’] ) );
/*
* and all of the original post data at that time.
*/
$post = get_post( $post_id );
/*
If you do not want the existing users to become the author of your new post,
* and then change the following couple of lines as follows new_post_author = $post->post_author
*/
$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;
/*
* If post data is present, then create the duplicate post
*/
If (isset( post ) and $post= null) {(isset( $post) && $post!= null)
/*
* Post data array with new post date
*/
$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 using the wp_insert_post() function
*/
$new_post_id = wp_insert_post( $args );
/*
* find the current terms of service and make them conform to the 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 taxonomies as) {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 meta data for post in just 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 in $meta_info) {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'”;
}
A $sqlQuery.= explode(” UNION ALL “, $sql_query_sel);
$wpdb->query($sql_query);
}
/*
* Lastly, go to the edit screen for the draft that has been updated.
*/
wp_redirect( admin_url( ‘post.php?action=edit&post=’ . $new_post_id ) );
exit;
else Other than that,
wp_die(‘Post creation was unsuccessful, and could not locate the an original post: . $post_id);
}
}
add_action( ‘admin_action_rd_duplicate_post_as_draft’, ‘rd_duplicate_post_as_draft’ );
/*
Include the link in duplicate in the action list for post_row_actions
*/
function rd_duplicate_post_link( $actions, $post ) {
if (current_user_can(‘edit_posts’)) {
$actions[‘duplicate’] = ‘Duplicate’;
}
Return $actions
}
add_filter( ‘post_row_actions’, ‘rd_duplicate_post_link’, 10, 2 );
To enable cloning on pages as well, apply the same code but change the last line by:
add_filter(‘page_row_actions’, ‘rd_duplicate_post_link’, 10, 2);
Once you have done that, you can save the file, and then reupload the file to your WordPress server. After that, you can go over to the WordPress dashboard. The duplicate button will now be displayed whenever you click on a post or page you’d like to duplicate.
Leave a Reply