I've got the following code in the 'functions.php' file of a wordpress theme
$ppost_data = build_post( $pID, $pcontent, $pname, $ptitle, $pstatus, $ptype, $pset_comment_status );
wp_insert_post($ppost_data);
and here's the 'build_post()' function:
function build_post( $pID, $pcontent, $pname, $ptitle, $pstatus, $ptype, $pset_comment_status ) {
return array(
'ID'=>$pID,
'post_content'=>$pcontent,
'post_name'=>$pname,
'post_title'=>$ptitle,
'post_status'=>$pstatus,
'post_type'=>$ptype,
'comment_status'=>$pset_comment_status,
'post_author' => 1
);
The variables are all set, and all of the data is in the $ppost_data
array correctly, but the page isn't being added. No errors are being thrown. Any ideas?
$pID
come from? If it's not the ID of an existing post, the function will fail.