Title: Submit content as a draft?
Last modified: August 20, 2016

---

# Submit content as a draft?

 *  [sackbot14](https://wordpress.org/support/users/sackbot14/)
 * (@sackbot14)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/submit-content-as-a-draft/)
 * Hello. 🙂
 * **Is it possible to submit some content (so a string of some sort) directly to
   the database as a draft? If so, how can I do so?** I am the only one to be doing
   the submissions, so there is no worry of processing or censoring or any of that
   sort of precautionary actions to perform.
 * I looked at the database tables and found it to be a little… scary to try to 
   do it by myself, so I came here to ask.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/submit-content-as-a-draft/#post-3180501)
 * You could use $wpdb->insert(). Or you could use phpMyAdmin to do it manually.
   You’re better off using wp_insert_post() to be safe, the other methods could 
   easily corrupt things with no indication why. In all cases, the array key or 
   column value of ‘post_status’ needs to equal ‘draft’.
 *  Thread Starter [sackbot14](https://wordpress.org/support/users/sackbot14/)
 * (@sackbot14)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/submit-content-as-a-draft/#post-3180508)
 * Okay, how can I get that function on a file I’m using? It’s not in the wordpress
   directory, the file I am using. Also, the file I am using has another mysql connection,
   but I can always close that one and open a new one for wordpress as the insertion
   happens at the end of the script.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/submit-content-as-a-draft/#post-3180509)
 * Oh, that changes things 🙂
    To use the existing connection, you need to use php’s
   mysql_* functions, which is very roughly the same as using the $wpdb object. 
   As long as you are careful, it will work. To use WP functions, you need to load
   the WP environment, which will open it’s own connection. You normally do this
   by including wp-load.php on your page. I haven’t tried doing this outside of 
   the WP directories, but it shouldn’t make any difference.
 * DB work outside of WP is not part of my experience, but the wp-load include probably
   needs to be inside a function to ensure it is not run before the other connection
   is closed. If it were me, I would go ahead and use the existing connection. I
   would analyze the insert statement sent from wp_insert_post() to ensure I’ve 
   got my own statement right. Then test thoroughly that WP sees my insert as a 
   valid draft post before turning my script loose.
 *  Thread Starter [sackbot14](https://wordpress.org/support/users/sackbot14/)
 * (@sackbot14)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/submit-content-as-a-draft/#post-3180511)
 * Got it, thank you so much for the help. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Submit content as a draft?’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [string](https://wordpress.org/support/topic-tag/string/)
 * [submit](https://wordpress.org/support/topic-tag/submit/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 2 participants
 * Last reply from: [sackbot14](https://wordpress.org/support/users/sackbot14/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/submit-content-as-a-draft/#post-3180511)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
