Created
January 7, 2014 18:43
-
-
Save javierarques/8304351 to your computer and use it in GitHub Desktop.
[WP] Create post with Contact Form 7 post data via wpcf7_before_send_mail hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wpcf7_before_send_mail', 'cf7_create_post', 10, 1); | |
function cf7_create_post( $data ) { | |
extract($data->posted_data); | |
$post_id = wp_insert_post( array( | |
'post_status' => 'draft', | |
'post_title' => $nombre, | |
'post_content' => $consulta | |
)); | |
add_post_meta( $post_id, 'email', $email, true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hola.
Estoy desarrollando una web en la que necesito crear post a partir de los datos de un formulario (imagen destacada incluída)
¿Tu código hace eso?
Perdona la molestia y muchas gracias
Ignacio Arregui