So let’s first understand what WordPress is
WordPress, which is more adaptable and which is best for online business and better contributing to a blog also and an exceptionally intriguing component of layout determination, and this must comprehend somewhat about the location before utilizing WordPress
It isn’t just fabricated neatly and everyone around improved, yet it’s some accessible apparatuses that you can use to help with streamlining your site.
These are the highlights referenced beneath:
● Free and open source
● A considerable number of topics to urge in
● Most documented CMS
● Adjustable
● Incredible publishing content to blog modules
● Portable well disposed
● Search engine optimization prepared
● Refreshing your site is straightforward
● Advantageous
● Incredible for internet business
Presently we should always return to the way to copy a page in WordPress
In four simple advances, you’ll copy your substance in WordPress
Reorder
Reorder your substance physically; if you have numerous pages, be found out to be adjusted.
Square supervisor
You can utilize work in Block Editor usefulness.
Introduce a module
You can utilize a module to repeat your pages.
Add code
To add a code, open a content tool, and you’ll add code to your WordPress functions.php record.
In the wake of opening the functions.php record, you ought to add the accompanying code.
CODE
/* Duplicate posts and pages work. Copies show up as drafts, and therefore the client is diverted to the Edit screen. */
work rd_duplicate_post_as_draft(){
worldwide $wpdb;
on the off chance that (! ( isset( $_GET[‘post’]) || isset( $_POST[‘post’]) || ( isset($_REQUEST[‘action’]) && ‘rd_duplicate_post_as_draft’ == $_REQUEST[‘action’] ) {
wp_die(‘No post to repeat has been supplied!’);
}
/* Nonce confirmation */
in the event that ( !isset( $_GET[‘duplicate_nonce’] ) || !wp_verify_nonce( $_GET[‘duplicate_nonce’], basename( __FILE__ )
return;
/* This gets the primary post or page ID */
$post_id = (isset($_GET[‘post’]) ? absint( $_GET[‘post’] ) : absint( $_POST[‘post’] ) );
/* … at that time gets the primary post information. */
$post = get_post( $post_id );
/* to settle on another client because the post creator, use $new_post_author = $post->post_author;. Something else… */
$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;
/* If the post information exists, make the copy */
on the off chance that (isset( $post ) && $post != invalid) {
/* Create another post information exhibit */
$args = cluster(
‘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 utilizing wp_insert_post() */
$new_post_id = wp_insert_post( $args );
/* Get all current post terms; at that time, set them against the new draft. */
$taxonomies = get_object_taxonomies($post->post_type);/returns cluster of scientific categorization names for post kind, 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, bogus);
}
/* Duplicate everything of the post metadata */
$post_meta_infos = $wpdb->get_results(“SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id”);
in the event that (count($post_meta_infos)!=0) {
$sql_query = “Addition INTO $wpdb->postmeta (post_id, meta_key, meta_value) “;
foreach ($post_meta_infos as $meta_info) {
$meta_key = $meta_info->meta_key;
in the event that( $meta_key == ‘_wp_old_slug’ ) proceed;
$meta_value = addslashes($meta_info->meta_value);
$sql_query_sel[]= “SELECT $new_post_id, ‘$meta_key’, ‘$meta_value'”;
}
$sql_query.= collapse(” 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 fizzled, couldn’t discover unique post: ‘ . $post_id);
}
}
add_action( ‘admin_action_rd_duplicate_post_as_draft’, ‘rd_duplicate_post_as_draft’ );
/* Add the copy hook up with the activity list for post_row_actions */
work rd_duplicate_post_link( $actions, $post ) {
on the off chance that (current_user_can(‘edit_posts’)) {
$actions[‘duplicate’] = ‘ID, basename(__FILE__), ‘duplicate_nonce’ ) . ‘” title=”Duplicate this thing” rel=”permalink”>Duplicate’;
}
bring $actions back;
}
add_filter(‘post_row_actions’, ‘rd_duplicate_post_link’, 10, 2 );
add_filter(‘page_row_actions’, ‘rd_duplicate_post_link’, 10, 2);
Once you’ve added the code, save your changes and log out of your FTP connection.
Whenever you’ve added the code, save your progressions and sign off of your FTP association.
To utilize Duplicate Page, you merely need to:
● Introduce and enact the module, which was done previously.
● Design its settings to deal with your issues.
● Go to Pages > All or Posts > All to trace down the substance you would like to repeat.
● Snap-on the Duplicate.
At that time, copy posts/pages will be made and saved as a draft, publish, pending, and private counting on settings.
When you set all of those, it’ll be not difficult to repeat the substance.
Happy learning!