[英]Automatically send to “Post” or “Page” Wordpress plugin Contact Form 7
我希望CF7提交的内容自动发布到我网站上的“发布”或“页面”中。
我看到有必要添加一些动作挂钩,但是我没有技能吗? 有人可以帮我吗?
谢谢!
编辑:我可以使用Blog_by_Email服务(将提交发送到一些电子邮件,然后自动发布帖子)来做到这一点,但是我需要在该帖子上使用用户ID。
您可以使用wp_insert_post做到这一点
//sample code
if(isset($_POST['submit_button'])){
$my_post = array(
'post_title' => $_POST['title'],
'post_date' => date("Y-m-d H:i:s"),
'post_content' => $_POST['description'],
'post_status' => 'pending',
'post_type' => 'post',
'post_author' => $user_id
);
$the_post_id = wp_insert_post( $my_post );
}
有关wp_insert_post的更多信息,请访问此页面http://codex.wordpress.org/Function_Reference/wp_insert_post
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.