Posting data from a table help – wp_insert_post
-
I’m trying to post some data from a table and I can’t get it to post the content. It will loop through and make a post for each row with the title but no content.
Suggestions?
$query = mysql_query("SELECT * FROM table"); while($rows = mysql_fetch_array($query)){ $title = $rows['title']; $content = $rows['content']; $category = 1; $status = 'publish'; $category = array($category); wp_insert_post(array( 'post_title' => $title, 'post_content' => $content, 'post_category' => $category, 'post_status' => $status )); }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Posting data from a table help – wp_insert_post’ is closed to new replies.