wp_insert_post error: " Content, title, and excerpt are empty."
I'm trying to insert WooCommerce products into the WordPress database via
PHP. A WooCommerce product is just a post with post-type=product, so I
thought that this should work:
$mypost = array('post-title' => $secondexplosion[0], 'post-type' =>
'product',
'post-status' => 'publish', 'post-content' => $secondexplosion[1],
'post-excerpt' => '');
$postid = wp_insert_post($mypost, true);
$secondexplosion is a String array that contains the post-title and
post-content; I checked, and it does not contain null values or anything
problematic. Why, then, is wp_insert_post returning the error "Content,
title, and excerpt are empty"? Thanks much!
No comments:
Post a Comment