Title: Using API / MYSQL to create posts
Last modified: August 19, 2016

---

# Using API / MYSQL to create posts

 *  [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * (@spaaarky13)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/)
 * Hey,
 * I’m trying to create posts via php run throuh a cron job. Can someone link me
   some stuff on how I would go about doing that? Do I do it directly via the MYSQL
   database? Or do I use an API?

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

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419334)
 * Please refrain from bumping as per the [forum rules](http://wordpress.org/support/topic/374352?replies=1).
 * You can find information on the WordPress cron functions [here](http://codex.wordpress.org/Category:WP-Cron_Functions).
 * Here’s a few quick links for scheduling cron events.
    [http://codex.wordpress.org/Function_Reference/wp_schedule_event](http://codex.wordpress.org/Function_Reference/wp_schedule_event)
   [http://codex.wordpress.org/Function_Reference/wp_schedule_single_event](http://codex.wordpress.org/Function_Reference/wp_schedule_single_event)
 * Beyond the docs that’s all i know, i havn’t written anything using the cron process
   myself.
 *  Thread Starter [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * (@spaaarky13)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419369)
 * Ok fair enough about the bumping. I’ve always found on this forum that yu have
   to bump for it to get noticed. Next time I won’t. I’ll check out the links in
   a bit 🙂
 *  Thread Starter [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * (@spaaarky13)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419414)
 * Ok I’ve finally had a chance to look into it. I’ve looked through those posts
   and seen what they do but I don’t think they’re what I need to do. I need a way
   to create a post via php that will have the category, title, tags, excerpt and
   the body included in
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419417)
 * [http://codex.wordpress.org/Function_Reference/wp_insert_post](http://codex.wordpress.org/Function_Reference/wp_insert_post)
 * You could use that alongside the cron functions to automate the process. I’ve
   not used either the cron or insert post functions before myself, else i’d offer
   an example. Unfortunately you’ll have to figure out their usage yourself and/
   or alternatively have a search around..
 * Some related support topics.
    [http://wordpress.org/tags/wp_insert_post](http://wordpress.org/tags/wp_insert_post)
 *  Thread Starter [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * (@spaaarky13)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419421)
 * ^ That is exactly what I’m after. One question though which you may or may not
   be able to answer is, how do I actually ‘contact’ wordpress to add in the post.
   AKA where do I put the code?
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419426)
 * Where you contacting it from?
 * I’m not sure i know how to answer your question.
 *  Thread Starter [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * (@spaaarky13)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419432)
 * Like how do I tell wordpress who I am as such. Like when yoiu deal with mysql
   you tell them the server address and a username and password. How do you do that
   with wordpress?
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419439)
 * Do you mean how can you do it remotely and authenticate yourself with WordPress?
 * WordPress does have some remote publishing protocols.
 * Some info on the XML RPC.
    [http://codex.wordpress.org/XML-RPC_Support](http://codex.wordpress.org/XML-RPC_Support)
 * Supported clients.
    [http://codex.wordpress.org/Weblog_Client](http://codex.wordpress.org/Weblog_Client)
 * I don’t use any of these things myself so i can’t comment on them, but hopefully
   something there will help.
 *  Thread Starter [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * (@spaaarky13)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419460)
 * Sadly that’s not what I need. the one was exactly what I needed but it was for
   the blogger.com’s API rather then for just a normal blog. Do the mysql databases
   change at all? Because if not then I can just edit the mysql tables and do it
   that way
 * EDIT: Looks like this: metaWeblog.newPost is the thing I need to use but i can’t
   find any documentation on it hardly
 *  Thread Starter [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * (@spaaarky13)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419493)
 * Ok I’ve found a solution 🙂 Look at [this](http://www.notesbit.com/index.php/web-mysql/web-scripts/standalone-access-the-wordpress-database-using-wpdb/)
   and [this](http://codex.wordpress.org/Function_Reference/wp_insert_post). Works
   great. Only issue I’m having is a way to define the post’s thumbnail. Any ideas
   guys?
 *  Thread Starter [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * (@spaaarky13)
 * [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419494)
 * Ok found some more info. It looks like I need to use add_post_meta but I have
   no idea how to use it for the thumbnail

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

The topic ‘Using API / MYSQL to create posts’ is closed to new replies.

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [create posts](https://wordpress.org/support/topic-tag/create-posts/)
 * [database](https://wordpress.org/support/topic-tag/database/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 11 replies
 * 2 participants
 * Last reply from: [spaaarky13](https://wordpress.org/support/users/spaaarky13/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/using-api-mysql-to-create-posts/#post-1419494)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
