如何导出 WordPress 帖子?
如何将 WordPress 帖子导出为 XML 或 CSV?我正在寻找一种在 PHP 的帮助下实现这一点的巧妙方法。
注意:我不想通过管理面板执行此操作,因为我想使其自动化。
How to export WordPress posts to XML or CSV? I am looking for a neat way to do it with the help of PHP
.
Note: I don't want to do it via the admin panel because I want to automate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要从 PHP 中执行此操作,请执行以下操作:
publish
的帖子。。
To do it from PHP, do it like this:
publish
from the database..
在您的 WordPress 设置中,请查看
wp-admin/export.php
第 28-48 行(在 3.0 设置中)。这是生成可在管理中下载的 XML 文件的代码。您也许可以在自己的代码中使用它(不幸的是,它没有组织成函数,因此您必须进行一些复制粘贴)。
另外,您可以自动下载 http://yourblog/wp-admin/export.php? download,因为此 URI 始终会重定向到新的 XML 导出。不过,您必须为此输入您的凭据。
On your Wordpress setup, take a look at
wp-admin/export.php
lines 28-48 (on a 3.0 setup).This is the code that generates the XML file downloadable in the admin. You could maybe use that in your own code (unfortunately, it's not organized into a function, so you'll have to do some copy-paste-ing).
Also, you could automate the downloading of http://yourblog/wp-admin/export.php?download, as this URI would always redirect to a fresh XML export. You'll have to deal with inputting your credentials for that, though.
好吧,根据 Wordpress 博客...
Well according to the Wordpress blog...