The duplicate_post_create_duplicate function doesn’t support post_id
-
Hello,
Trying to use the duplicate_post_create_duplicate function found here;
https://duplicate-post.lopo.it/docs/developers-guide/functions-template-tags/duplicate_post_create_duplicate/It notes that post_id is supported;
$post
(int|WP_Post|null) post object to be cloned.But checking source after I got the message;
“Copy features for this post type are not enabled in options page”I noticed the function used $post object without checking for an int and switching post_id to a post object;
if (!duplicate_post_is_post_type_enabled($post->post_type) && $post->post_type != 'attachment')I’m going to switch in my code to use a post object, but might be a good call to do a check for ID(int) and do a get_post before using $post object.
Thank you
The page I need help with: [log in to see the link]
The topic ‘The duplicate_post_create_duplicate function doesn’t support post_id’ is closed to new replies.