http://www.ex-tra.jp/kosukekato/archives/10669
http://www.ex-tra.jp/kosukekato/archives/10676
https://wordpress.org/support/topic/issue-with-wpcf7_before_send_mail/
wpcf7_before_send_mail にフックっする
function wpcf7_post($cf7) { $fname = $cf7->posted_data["fname"]; $ftitle = $cf7->posted_data["ftitle"]; $fdesc = $cf7->posted_data["fdesc"];
$fname = $cf7->posted_data[“フィールドネーム”];
で$fnameに収納
多分 これ切れとるけど
$postだわ
$post = ( 'post_title' => $ftitle, 'post_content' => $fdesc, 'post_status' => 'draft', 'post_type' => 'post_type', 'post_author' => 'user' ); $id = wp_insert_post($post);
$terms = get_terms('taxonomies'); $floor_id = ''; foreach($terms as $term) { if(($term->name == 'カテゴリ名') && ($ftax == 'なんか')) { $floor_id = $term->term_id; } } wp_set_post_terms($id, $floor_id, 'events_categories', true);
こうかいてあるけど
https://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/wp_set_post_terms
によると かすたむポストではwp set object termsを使えといっとりますが?
add_post_meta($id, 'fname', $fname, true);
簡単らしい
add_action( 'wpcf7_before_send_mail', 'wpcf7_post' );
締め