• Resolved itsmeka

    (@itsmeka)


    I am using WordPress Version 3.3.1 and duplicate post version 2.2. When i click to clone or new draft of main post, it duplicate the post successfully but showing following message:

    Warning: array_diff() [function.array-diff]: Argument #1 is not an array wp-content\plugins\duplicate-post\duplicate-post-admin.php on line 227
    Warning: Invalid argument supplied for foreach() in wp-content\plugins\duplicate-post\duplicate-post-admin.php on line 229
    Warning: Cannot modify header information – headers already sent by (output started at wp-content\plugins\duplicate-post\duplicate-post-admin.php:227) in wp-includes\pluggable.php on line 866

    https://www.ads-software.com/extend/plugins/duplicate-post/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter itsmeka

    (@itsmeka)

    Problem is solved. ??
    i have changed following code in duplicate-post-admin.php at line 278:

    if ($post->post_type == 'page' || (function_exists('is_post_type_hierarchical') && is_post_type_hierarchical( $post->post_type )))
    	do_action( 'dp_duplicate_page', $new_post_id, $post );
    	else
    	do_action( 'dp_duplicate_post', $new_post_id, $post );

    to

    if ($post->post_type == 'page' || (function_exists('is_post_type_hierarchical') && is_post_type_hierarchical( $post->post_type )))
    	do_action( 'dp_duplicate_page', $new_id, $post );
    else
    	do_action( 'dp_duplicate_post', $new_id, $post );

    Hi,
    thank you for reporting the issue.

    Your workaround isn’t exactly right, there is no $new_id in that function, so probably it simply prevents actions to be called.

    This means that custom fields will never be copied.

    You should try to change lines 224-225 from

    $post_meta_keys = get_post_custom_keys($post->ID);
    $meta_blacklist = explode(",",get_option('duplicate_post_blacklist'));

    to

    $post_meta_keys = get_post_custom_keys($post->ID);
    if (empty($post_meta_keys)) return;
    $meta_blacklist = explode(",",get_option('duplicate_post_blacklist'));

    I hope this works.

    I’ll make sure to fix the issue in the next version.
    Thank you!

    Thread Starter itsmeka

    (@itsmeka)

    I did as you said. Now it is working fine but it does not copy categories, tag and custom fields. After cloning the post, it takes the default categories(Uncategorized), tags(No Tags). Please advice.

    Thank you in advance.

    Thread Starter itsmeka

    (@itsmeka)

    Hi logo,
    Sorry, i made some stupid wrong when i edited. Your plugins is great and working great. Thanks for your great work and reply.

    Hi,
    version 2.3 (out now) includes the fix for this bug.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Duplicate Post] array_diff() problem’ is closed to new replies.