+ Reply to Thread
Results 1 to 5 of 5
Like Tree2Likes
  • 1 Post By lankatr
  • 1 Post By lankatr

Thread: Warning: array_merge() [function.array-merge]: Argument #2 is not an array

  1. #1
    lankatr is offline x10Hosting Member lankatr is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    24

    Warning: array_merge() [function.array-merge]: Argument #2 is not an array

    I'm getting the error " Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/lankatr/public_html/wp/wp-includes/post.php on line 1856"

    Line 1856 :
    // Merge old and new fields with new fields overwriting old ones.
    $postarr = array_merge($post, $postarr);
    $postarr['post_category'] = $post_cats;
    if ( $clear_date ) {
    $postarr['post_date'] = current_time('mysql');
    $postarr['post_date_gmt'] = '';
    }

    if ($postarr['post_type'] == 'attachment')
    return wp_insert_attachment($postarr);

    return wp_insert_post($postarr);
    }




    dinomirt96 likes this.

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Warning: array_merge() [function.array-merge]: Argument #2 is not an array

    Quote Originally Posted by lankatr View Post
    $postarr = array_merge($post, $postarr);
    The error message is saying that $postarr is not an array.

    Since I cannot see any code that assigns $postarr a value, I cannot possibly know what the problem is.
    Nothing is always absolutely so.

  3. #3
    lankatr is offline x10Hosting Member lankatr is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    24

    Re: Warning: array_merge() [function.array-merge]: Argument #2 is not an array

    Here what i found in post.php

    **
    * Insert a post.
    *
    * If the $postarr parameter has 'ID' set to a value, then post will be updated.
    *
    * You can set the post date manually, but setting the values for 'post_date'
    * and 'post_date_gmt' keys. You can close the comments or open the comments by
    * setting the value for 'comment_status' key.
    *
    * The defaults for the parameter $postarr are:
    * 'post_status' - Default is 'draft'.
    * 'post_type' - Default is 'post'.
    * 'post_author' - Default is current user ID ($user_ID). The ID of the user who added the post.
    * 'ping_status' - Default is the value in 'default_ping_status' option.
    * Whether the attachment can accept pings.
    * 'post_parent' - Default is 0. Set this for the post it belongs to, if any.
    * 'menu_order' - Default is 0. The order it is displayed.
    * 'to_ping' - Whether to ping.
    * 'pinged' - Default is empty string.
    * 'post_password' - Default is empty string. The password to access the attachment.
    * 'guid' - Global Unique ID for referencing the attachment.
    * 'post_content_filtered' - Post content filtered.
    * 'post_excerpt' - Post excerpt.
    *
    * @since 1.0.0
    * @link http://core.trac.wordpress.org/ticket/9084 Bug report on 'wp_insert_post_data' filter.
    * @uses $wpdb
    * @uses $wp_rewrite
    * @uses $user_ID
    *
    * @uses do_action() Calls 'pre_post_update' on post ID if this is an update.
    * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update.
    * @uses do_action() Calls 'save_post' and 'wp_insert_post' on post id and post data just before
    * returning.
    *
    * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database
    * update or insert.
    * @uses wp_transition_post_status()
    *
    * @param array $postarr Optional. Overrides defaults.
    * @param bool $wp_error Optional. Allow return of WP_Error on failure.
    * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
    */
    function wp_insert_post($postarr = array(), $wp_error = false) {
    global $wpdb, $wp_rewrite, $user_ID;

    $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
    'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
    'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '',
    'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0);

    $postarr = wp_parse_args($postarr, $defaults);
    $postarr = sanitize_post($postarr, 'db');

    // export array as variables
    extract($postarr, EXTR_SKIP);

  4. #4
    spadija's Avatar
    spadija is offline x10Hosting Member spadija is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    48

    Re: Warning: array_merge() [function.array-merge]: Argument #2 is not an array

    Have you tried deactivating your plugins one by one to see if one of them is causing the problem?

  5. #5
    lankatr is offline x10Hosting Member lankatr is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    24

    Re: Warning: array_merge() [function.array-merge]: Argument #2 is not an array

    This problem came after I installing a plugin so i deactivated and deleted that plugin but the problem is still there

    same error comes even when i deactivate all plugins
    Last edited by lankatr; 04-23-2010 at 08:34 AM.
    karimirt47 likes this.

+ Reply to Thread

Similar Threads

  1. Array sorting in php
    By drf1229 in forum Programming Help
    Replies: 2
    Last Post: 01-06-2010, 08:53 PM
  2. Post JS Array to PHP
    By diabolo in forum Programming Help
    Replies: 5
    Last Post: 09-26-2009, 10:15 AM
  3. [REQ] [200] PHP create array
    By diabolo in forum The Marketplace
    Replies: 3
    Last Post: 12-15-2008, 02:39 PM
  4. Help with php array
    By RossSchVle in forum Programming Help
    Replies: 3
    Last Post: 11-09-2008, 07:36 AM
  5. Recursive PHP array to Javascript array/object
    By Veridis in forum Programming Help
    Replies: 0
    Last Post: 04-16-2008, 02:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers