使用MySql在Wordpress中插入帖子 [英] Inserting a post in Wordpress using MySql

查看:112
本文介绍了使用MySql在Wordpress中插入帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何使用sql在Wordpress中插入新帖子吗?

Does anyone know how to insert a new post into Wordpress using sql?

推荐答案

您可以使用Post对象:

You can use the Post object:

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

此处找到了更多信息.

这篇关于使用MySql在Wordpress中插入帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆