-3
A
回答
1
基本上你所要做的就是在Wordpress的wp_posts
表中插入你的记录。该表具有以下字段(如果你使用最新的3.9.2版本,当然):
ID - (no explanation needed, it is auto-increment value)
post_author - (here in your case put 1 - this is Administrator account)
post_date - (no explanation needed)
post_date_gmt - (same as above, but date is GMT)
post_content - (your article content, HTML code, if any, may or may not be escaped)
post_title - (no explanation needed)
post_excerpt - (can be empty in your case)
post_status - (there are six of them, in your case put "publish" or "draft" if you want manually to make post visible at later stage)
comment_status - (put "closed" if you want to disable comments or "open" otherwise)
ping_status - (same as above, but it applies for ping)
post_password - (put empty string)
post_name - (put lowercase converted post title, but replace spaces with "-", this is URL friendly version of the post name, ex: my-first-post-title)
to_ping - (put empty string)
pinged - (put empty string)
post_modified - (put date of the post)
post_modified_gmt - (same as above, but date is GMT)
post_content_filtered - (put empty string)
post_parent - (put 0 initially, later you can build your post hierarchy)
guid - (URL of the post, http://www.yourdomain.com/?page_id=the_ID_of_the_post)
menu_order - (put 0)
post_type - (put "page" or "post", there is a difference though)
post_mime_type - (put empty string)
comment_count - (put empty string)
这里是例如SQL查询与插入成功所需的最低值:
INSERT INTO wp_posts (post_author,post_date,post_date_gmt,post_content,post_title,post_excerpt,
post_status,comment_status,ping_status,post_password,post_name,to_ping,pinged,
post_modified,post_modified_gmt,post_content_filtered,post_parent,guid,
menu_order,post_type,post_mime_type,comment_count)
VALUES (1,'2014-08-28 02:00:00', '2014-08-28 00:00:00','<h1>Some content</h1>',
'My first post','Some excerpt','publish','closed', 'closed','','my-first-post',
'','','2014-08-28 02:00:00', '2014-08-28 00:00:00','',0,
'http://127.0.0.1/wordpress/?page_id=2000',0,'post','','')
记住,您的表wp_posts
可能有一个前缀。
相关问题
- 1. 自定义文章的Wordpress自定义文章
- 2. wordpress导入joomla文章
- 3. WordPress的页面和自定义文章
- 4. Woocommerce - Wordpress Hotel/Room自定义文章
- 5. wordpress自定义文章类型
- 6. WordPress自定义文章类型Single.php?
- 7. WordPress自定义文章编辑器?
- 8. WordPress的自定义文章类型
- 9. WordPress的自定义文章格式?
- 10. 如何在wordpress中自定义文章?
- 11. WordPress的自定义文章类型PHP
- 12. 表格帖子自定义文章 - WordPress
- 13. Wordpress文章的自定义模板
- 14. WP自定义文章类型导航
- 15. 在wordpress中迁移数据库后导入附加到文章的文件
- 16. 自定义文章网址?
- 17. 自定义文章类型
- 18. 从另一个自定义数据库导入wordpress到wordpress
- 19. 自定义文章类型的WordPress自定义搜索页面
- 20. WordPress的自定义文章类型导航+儿童
- 21. wordpress 3:为自定义文章类型创建导航菜单
- 22. 如何从自定义文章类型
- 23. 添加分页到自定义文章
- 24. Wordpress API插入文章?
- 25. 导出OpenCms的文章到Wordpress
- 26. 从WordPress创建iCal订阅链接自定义文章类型
- 27. wordpress自定义字段从现有的文章
- 28. wordpress预定义格式文章
- 29. 数据库文章:分页
- 30. 在WordPress后添加到自定义文章类型类别从前端(WordPress的)
谢谢你的努力,它帮助了我很多。 – 2014-08-27 10:47:06