1

I need public users to be able to submit posts, then have them be approved by a moderator or admin on the dashboard. Is this possible to do? I would like it to function very similarly to comments.

for example, users will post their own stories and then a moderator will approve it being posted.

I am new to this particular stackexchange (I use stackoverflow often) and wordpress development, so forgive me if this seems like a stupid question.

2 Answers 2

1

If you don't want to give users access to the WordPress admin screens and you don't want to use a premium plugin, you should create a form in a page and use wp_insert_post with the submitted data.

In your case, the "post_status" parameter could be used to "moderate":

$post = array(
    'post_title'   => $_POST['title_field'],
    'post_content' => $_POST['content_field'],
    'post_status'  => [ 'draft' | 'publish' | 'pending'| 'future' | 'private' | custom registered status ] //Set the status of the new post.
);

wp_insert_post($post);

The wp_insert_post function should take care of sanitizing the data before inserting it into the DB, but I recommend to double check and add filters if necessary.

3
  • I think you have to register_post_status() first.
    – Max Yudin
    Feb 8, 2013 at 18:49
  • @gyo would I create a separate PHP file to handle this form action and contain this code? Also, do I need to use register_post_status() as Max indicated? And if so, where would I put that?
    – Ethan
    Feb 8, 2013 at 18:55
  • Yep, use "register_post_status" for custom "statuses", not necessary if you use "draft". I'd submit the form via Ajax, or alternatively in your page-template place the logic inside an if (isset($_POST)) block.
    – gyo
    Feb 8, 2013 at 19:07
0

The only plugin that I know of that supports this is Gravity Forms.

This tutorial should also be mostly relevant. http://yoast.com/gravity-forms-custom-post-types/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.