in file “duplicate-post-admin.php” find the below function
add this line to the function duplicate_post_make_duplicate_link_row($actions, $post)
if( !in_array(get_current_screen()->post_type, array('post', 'page')) ) return $actions;
this will show the actions links on pages and posts only, you still have to deactivate “Edit Screen” option in plugin settings
The new function must read
function duplicate_post_make_duplicate_link_row($actions, $post) {
if( !in_array(get_current_screen()->post_type, array('post', 'page')) ) return $actions;
if (duplicate_post_is_current_user_allowed_to_copy()) {
$actions['clone'] = '<a href="'.duplicate_post_get_clone_post_link( $post->ID , 'display', false).'" title="'
. esc_attr(__("Clone this item", DUPLICATE_POST_I18N_DOMAIN))
. '">' . __('Clone', DUPLICATE_POST_I18N_DOMAIN) . '</a>';
$actions['edit_as_new_draft'] = '<a href="'. duplicate_post_get_clone_post_link( $post->ID ) .'" title="'
. esc_attr(__('Copy to a new draft', DUPLICATE_POST_I18N_DOMAIN))
. '">' . __('New Draft', DUPLICATE_POST_I18N_DOMAIN) . '</a>';
}
return $actions;
}
Thank you Fad Bad, your solution worked for me.
If anyone wants to turn off duplication for just pages, here is the above code altered a bit:
if( in_array(get_current_screen()->post_type, array('page')) ) return $actions;
In the code, I removed the exclamation point (not symbol) from in front of the first array and posts from the second array.
This means if the current screen IS the page post type, then don’t show the links.
Hope this helps. 🙂
Hi,
next version (to be released soon, I hope) will feature an option to enable/disable on a post-type basis.