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

lankatr

New Member
Messages
24
Reaction score
0
Points
0
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);
}



:mad:
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
$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.
 

lankatr

New Member
Messages
24
Reaction score
0
Points
0
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);
 

spadija

New Member
Messages
48
Reaction score
1
Points
0
Have you tried deactivating your plugins one by one to see if one of them is causing the problem?
 

lankatr

New Member
Messages
24
Reaction score
0
Points
0
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:
Top