mysql - 使用 MySql 在 Wordpress 中插入帖子

标签 mysql wordpress

有谁知道如何使用 sql 将新帖子插入 Wordpress 中?

最佳答案

您可以使用 Post 对象:

// 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 );

找到更多信息 here .

关于mysql - 使用 MySql 在 Wordpress 中插入帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1670838/

相关文章:

php - 通过单击按钮生成随机字符并将结果安全保存到数据库

php - 查询生成器 : IN clause with composite columns

wordpress - 结帐页面上的文件上传字段 woocommerce

wordpress - IE7/8 中的边距和填充问题

MySql - 几个列略有不同的表

php - 使第一个查询的结果成为第二个查询的 NOT IN 部分

mysql - 如何在 SQL 查询中忽略空参数

mysql - 如何在 WordPress 上设置网站更新(开发 -> 登台 -> 生产)?

php - Woocommerce 获取当前的运输区域

php - Wordpress 正在生成 400px x 300px 的缩略图,我如何将其更改为 210px x 210px