function my_form_tag_filter($tag){ if ( ! is_array( $tag ) ) return $tag; if(isset($_GET['carname_title'])){ $name = $tag['name']; if($name == 'carname_title') $tag['values'] = (array) $_GET['carname_title']; } return $tag; } add_filter('wpcf7_form_tag', 'my_form_tag_filter', 11);
carname_titleを変える。
コンタクトに作成
<a href='/?page_id=9&carname_title=<?php the_title(); ?>'>
二つの場合
//Contact form 7 のフォームに自動的に記事タイトルを入れる方法 function my_form_tag_filter($tag){ if ( ! is_array( $tag ) ) return $tag; if(isset($_GET['carname_title'])){ $name = $tag['name']; if($name == 'carname_title') $tag['values'] = (array) $_GET['carname_title']; } if(isset($_GET['car_url'])){ $name = $tag['name']; if($name == 'car_url') $tag['values'] = (array) $_GET['car_url']; } return $tag; } add_filter('wpcf7_form_tag', 'my_form_tag_filter', 11);