Frage

I want that submission from CF7 automatically gets posted to "Post" or a "Page" on my site.

I saw that it is necessary to add some action hook but I do not have the skills to do that? Can someone help me out please?

Thank you!

edit: I could do it with Blog_by_Email service (which sends submission to some email and then make a post automatically), but I need user id on the post.

War es hilfreich?

Lösung

You can use the wp_insert_post to do this

  //sample code
 if(isset($_POST['submit_button'])){
  $my_post = array(
    'post_title' => $_POST['title'],
    'post_date' => date("Y-m-d H:i:s"),
    'post_content' => $_POST['description'],
    'post_status' => 'pending',
    'post_type' => 'post',
    'post_author' => $user_id
    );
 $the_post_id = wp_insert_post( $my_post );
}

for more info about wp_insert_post visit this page http://codex.wordpress.org/Function_Reference/wp_insert_post

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top