0

I need to replicate a plugin's input form from the dashboard and make it available to the public so that they can enter data directly to the DB rather than using a form that is emailed and then copying and pasting it manually.

Once submitted, rather than publish, I need the entry to sit in draft mode rather than being published as we need final control over what is published.

What is the best way to trace the submission of a plugin's publish settings back to the DB?

Is there a standard function every post entry hits to submit to the DB in WordPress or is it different for every plugin.

Many thanks.

1 Answer 1

0

Those are some dangerous words "public...can enter data directly to the DB"

You could write your own form and use wp_insert_post()

Something like this:

$new_post = array(
    'comment_status' => 'closed',
    'ping_status' => 'closed',
    'post_author' => 1, // id of admin, or some other user
    'post_title' => $_POST['title'],
    'post_name' => $_POST['title'],
    'post_status' => 'draft',   
    'post_type' => 'post', // or whatever   
    'post_date' => date('Y-m-d H:i:s'),                         
);
$new_post_id = wp_insert_post( $new_post );
2
  • Thanks Ghost. Perhaps I sh I uld have mentioned that the form would only be available to those who have registered on the site. Sorry about that. I'm assuming the plugin would follow tjos route too, so if I search for wp_insert_post I should find all the fields? Commented Aug 27, 2013 at 4:20
  • Function Reference/wp insert post « WordPress Codex Commented Aug 27, 2013 at 14:08

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.