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.

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 );
  • 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? – SixfootJames Aug 27 '13 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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