您可以将这些值存储在cookie中,并在创建表单输入时填充它们。
所以在save_comment_meta_data
添加如下内容:
$commenter_data = array(
\'phone\' => $phone,
...
);
setcookie(\'commenter_data\', serialize($commenter_data), time()+1209600, COOKIEPATH, COOKIE_DOMAIN, false);
然后在创建表单时:
$commenter_data = isset($_COOKIE[\'commenter_data\']) ? unserialize($_COOKIE[\'commenter_data]) : array();
echo \'<p class="comment-form-title">\'.
\'<label for="phone">\' . __( \'Commenter Phone\' ) . \'</label>\'.
\'<input id="phone" name="phone" type="text" size="30" tabindex="5" value="\'. (array_key_exists(\'phone\', $commenter_data) ? $commenter_data[\'phone\'] : \'\') .\'" /></p>\';