• Resolved bertini

    (@bertini)


    Hello, so i’m using this function to add a page after I submit a form.

    I need the id of the PAGE (not post!) created… but it only returns a 0.

    The page is created but i don’t get the id…

    I’ve tried doing posts and it gets the id!

    My second question is where do I add the template.php so the function finds it?

    Thank you very much!!

Viewing 1 replies (of 1 total)
  • Thread Starter bertini

    (@bertini)

    The interesting part of my code is:

    //Create Paciente PAGE!!
      $new_post=array(
      	'post_name'  => $nombre." ".$apellido1." ".$apellido2,
      	'post_title' => $nombre." ".$apellido1." ".$apellido2,
      	'post_status' => 'publish',
      	'post_type'=> 'page',
      	'page_template'=>'paciente.php'
      );
    
      $pageID=wp_insert_post($new_post);
      echo $pageID;
Viewing 1 replies (of 1 total)
  • The topic ‘creating page with wp_insert_post’ is closed to new replies.