How to Duplicate Posts and Pages Without Plugin in WordPress
Duplicating existing content can save you time and effort, allowing you to quickly create new variations of page, post or landing page without starting from scratch.
While WordPress doesn't have a built-in duplicate feature, you can easily add this functionality using a simple code snippet. Here's a step-by-step guide:
1. Open the Theme Editor:

- Navigate to Appearance > Theme Editor in your WordPress dashboard.
- Locate the functions.php file on the right-hand side and click on it to open it for editing.
Note: It's generally recommended to create a child theme instead of modifying the main theme's functions.php file directly. This ensures that your customizations are preserved during theme updates.
2. Insert the Following Code:
Carefully paste the following code snippet at the end of the functions.php file:
// Add Duplicate Post/Page Option
function add_duplicate_link($actions, $post) {
if (current_user_can('edit_posts')) {
$actions['duplicate'] = '<a href="' . admin_url("admin.php?action=clone_post_as_draft&post=" . $post->ID) . '">Duplicate</a>';
}
return $actions;
}
add_filter('post_row_actions', 'add_duplicate_link', 10, 2);
add_filter('page_row_actions', 'add_duplicate_link', 10, 2);
// Duplicate Post Action
function clone_post_as_draft() {
if (!isset($_GET['post']) || empty($_GET['post'])) {
return;
}
$post_id = absint($_GET['post']);
$post = get_post($post_id);
if (empty($post) || !current_user_can('edit_post', $post->ID)) {
wp_die('Permission denied');
}
$new_post_id = wp_insert_post(array(
'post_title' => $post->post_title . ' (Copy)',
'post_content' => $post->post_content,
'post_status' => 'draft',
'post_type' => $post->post_type,
'post_author' => $post->post_author,
));
if ($new_post_id) {
$taxonomies = get_object_taxonomies($post->post_type);
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);
}
wp_redirect(admin_url('post.php?action=edit&post=' . $new_post_id));
exit;
} else {
wp_die('Error occurred while duplicating the post.');
}
}
add_action('admin_action_clone_post_as_draft', 'clone_post_as_draft');
3. Save the Changes:
Click on the "Update File" button to save the changes you made to the functions.php file.
4. Use the Duplicate Feature:

- Now, when you visit the Posts or Pages listing screens, you'll see a new "Duplicate" link next to each post or page.
- Simply click on the "Duplicate" link to create a draft copy of the selected content. You can then edit and customize this copy as needed.
Additional Considerations:
- Child Themes: It's generally recommended to create a child theme instead of modifying the main theme's functions.php file directly. This ensures that your customizations are preserved during theme updates.
- Custom Plugins: If you prefer not to edit theme files, you can also achieve the same functionality using a custom plugin. This approach can be more manageable for users who are less comfortable with code.
- Third-Party Plugins: There are also established third-party plugins that offer advanced features for duplicating posts and pages, often with additional options and customization settings.
By following these steps, you can efficiently create duplicates of your posts and pages