Inserting post from outside wp – works, kind of … help?
-
Hi,
running the following code:
<?php require('wp-blog-header.php'); // Create post object $my_post = array(); $my_post['post_title'] = 'My post'; $my_post['post_content'] = 'This is my next post.'; $my_post['post_status'] = 'publish'; $my_post['post_author'] = 1; $my_post['post_category'] = array('4'); // Insert the post into the database wp_insert_post( $my_post ); ?>
which inserts the post into the database … only problem is that the category field in the db is set to 0 and I set it to 4 in the array above.
anytone know why it’s appearing as 0 and not 4?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Inserting post from outside wp – works, kind of … help?’ is closed to new replies.