wordpress - wp_insert_post() returns null -


i creating page , childpages, using wp_insert_post(), whenever post made in custom post type. pages created fine wp_insert_post() not return id of childpages, instead returns null.

    $mainparr = array(     'post_title' => $value,     'post_status' => 'publish',     'post_type' => 'page',         'post_content' => ' ',     'comment_status' => 'closed',         'post_name' => $course_slug,     'menu_order' => 0,     );         $mainp_id=wp_insert_post( $mainparr, false);           update_post_meta($post->id,'course_page_id',$mainp_id);     $dokarr = array(             'post_title' => 'dokumenter',     'post_status' => 'publish',     'post_type' => 'page',         'post_content' => ' ',     'comment_status' => 'closed',         'post_name' => 'dokumenter',         'post_parent' => $mainp_id,     'menu_order' => 0,     );     $dokid = wp_insert_post( $dokarr, false ); 

the $mainp_id returned fine childpages $dokid return null, doing wrong?

nevermind found error. wp_insert_post_does return id, had different function overriding value of id before output, bad.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -