对于没有插件的自定义表单。您可以使用wordpress中现有的挂钩,如template\\u redirect。在重新定向到新页面之前调用此挂钩。您可以参考一篇深入的文章here
HTML表单
<div class="employee">
<input type="hidden" name="show_msg">
<form name="customer_details" method="POST" required="required" class="input-hidden">
Your Name: <input type="text" id="name" name="customer_name">
Your Email: <input type="text" id="email" name="customer_email">
Company: <input type="text" id="company" name="company">
Sex: <input type="radio" name="customer_sex" value="male">Male <input type="radio" name="customer_sex" value="female">Female
<textarea id="post" name="experience" placeholder="Write something.." style="height:400px;width:100%"></textarea>
<input type="submit" value="Submit">
<!--?php wp_nonce_field( \'wpshout-frontend-post\',\'form-submit\' ); ?-->
</form></div>
PHP Function
function wpshout_frontend_post() {
wpshout_save_post_if_submitted();
}
add_action(\'template_redirect\',\'wpshout_frontend_post\', 2);