bulk posting to wordpress via scripts
In current project i need to make bulk posts to wordpress (from text files) and need to add da开发者_StackOverflow社区tes of mine own choice .
What is best way to do it ?
Use XML-RPC. You can build a script that reads the text file, then makes an XML-RPC request to the WordPress server to create the post. You'll need to have a valid username and password to make this work (and will need to enable XML-RPC on the WordPress site as well).
The API is fairly well-defined. You make an XML-RPC call to metaWeblog.newPost
and pass in the blog information, the post content, and your username and password. WordPress does the rest. You can also specify the date the post was/will be published as an optional field.
Further reading
- XML-RPC Support « WordPress Codex
- WordPress XML-RPC MetaWeblog API « My own documentation of the API
- RFC: MetaWeblog API « Further documentation of the API
精彩评论