Hello,
I have an issue with wp_insert_post() function on 2.8.5 version (haven't worked with wordpress before that). The function makes two duplicate records in the database instead of one. Here is the code snippet:
$post['post_title'] = "test3";
$post['post_content'] = "another test3";
$post['post_status'] = 'publish';
$post['post_author'] = 1;
$post['post_category'] = array(0);
$post['post_date'] = "2009-10-01 01:01:01";
$post['post_date_gmt'] = "2009-10-01 01:01:01";
$post = add_magic_quotes($post);
$postID = wp_insert_post($post);
I've been trying to figure out what the problem might be. I tried to intercept the values of "$query" variable in wp-includes/wp-db.php file on 678 line and got an SQL query, which posts to the database:
INSERT INTO wp_posts (post_author,post_date,post_date_gmt,post_content,post_content_filtered,post_title,post_excerpt,post_status,post_type,comment_status,ping_status,post_password,post_name,to_ping,pinged,post_modified,post_modified_gmt,post_parent,menu_order,guid) VALUES ('1','2009-10-01 01:01:01','2009-10-01 01:01:01','toje test3','','test3','','publish','post','open','open','','test3','','','2009-10-01 01:01:01','2009-10-01 01:01:01','0','0','')
This query appears in the variable only once, as it should, yet each time wp_insert_post() makes two duplicate records instead of one, which leads me to a conclusion that another SQL query runs somewhere else.
Can somebody help me?