从没有wordpress面板的用户提交帖子
问题描述:
我想创建一个系统,用户可以提交帖子。 为此,我将用户角色更改为贡献者。 它很完美,用户可以提交帖子。 但我不喜欢用户可以访问wordpress面板。 我想让用户从主题中的自定义用户配置文件中提交他们的帖子。 我有这个功能吗?从没有wordpress面板的用户提交帖子
答
有2种方法可以做到这一点: 方法1:
There are certain plugins that you can use to accomplish the task.
The below is an example:
https://wordpress.org/plugins/user-submitted-posts/screenshots/
方法2:
You too can achieve this functionality by writing a piece of code that will insert the data in the posts table. for that you have to create a page template and create a form for that template and write code that will work on submit of the form.
Make sure the form data gets inserted into the posts table.
+0
好吧,所以这里是步骤: 1:创建一个表单页面模板,并带有所需的字段。 2:点击提交按钮尝试在function.php中调用wp_insert_post。以下链接最好地描述了如何使用wp_insert_post插入帖子: https://developer.wordpress.org/reference/functions/wp_insert_post/。 –
http://wordpress.stackexchange.com/questions/71382/ add-custom-post-type-items-from-front尝试像这样 – vel