简单轻松地创建博客文章

时间:2010-04-10 17:47:22

标签: wordpress

我有一个脚本,可以从各种来源收集图像,链接和一些文本内容。它遍历并创建了许多帖子。

我想把每篇文章都添加到Wordpress中,标题,图片和链接。

有人能提出一个简单的方法吗?

2 个答案:

答案 0 :(得分:0)

来自Wordpress function reference

// Create post object
  $my_post = array();
  $my_post['post_title'] = 'My post';
  $my_post['post_content'] = 'This is my post.';
  $my_post['post_status'] = 'publish';
  $my_post['post_author'] = 1;
  $my_post['post_category'] = array(8,39);

// Insert the post into the database
  wp_insert_post( $my_post );

function to attach the image

  

wp_insert_attachment($ attachment,   $ filename,$ parent_post_id);

答案 1 :(得分:0)

Wordpress支持多个基于XML-RPC的API。

http://codex.wordpress.org/XML-RPC_Support

它还通过电子邮件支持帖子,在您的情况下可能更简单。

http://codex.wordpress.org/Post_to_your_blog_using_email

相关问题