[wp-hackers] How to create posts via SQL queries

Richard Coffre pyxosnews at gmail.com
Thu Aug 31 21:21:55 GMT 2006


*My current WP configuration :*
*- WordPress* release : 2.0.4
*- Theme* : default
*- Plugins * : none
*- Provider* : ovh

*Issue :*
I try to insert posts with the queries such as ones defined below.

Queries are successful because  I can see the posts in the admin console.
Unfortunately, I can see them in the blog.

If I create posts via admin, everything is OK,

It is sure there is something wrong  but I do not  know what. [image: blink]

Thanks in advance for any information

These are my queries :

            INSERT INTO $wpdb->posts (    ID, post_author, post_date,
post_date_gmt, post_content, post_title, post_category, post_excerpt,
post_status, comment_status, ping_status,
                                    post_password, post_name, to_ping,
pinged, post_modified, post_modified_gmt, post_content_filtered,
post_parent, guid, menu_order,
                                    post_type, post_mime_type, comment_count)
            VALUES (    $articleID, 1, '$dateJour', '$dateJour',
                    'open','','" .
sanitize_title(utf8_decode($data[1])) . '-' . $data[2] . "','','',
            INSERT INTO $wpdb->post2cat (post_id, category_id)
            VALUES ($articleID, " . $categories[$data[0]] . ")

More information about the wp-hackers mailing list