wp-cli/export-command

将WordPress内容导出到WXR文件。

安装次数: 4,838,056

依赖项: 4

建议者: 0

安全性: 0

星标: 12

关注者: 9

分支: 27

开放问题: 7

类型:wp-cli-package

v2.1.12 2023-09-18 21:41 UTC

README

将WordPress内容导出到WXR文件。

Testing

快速链接: 使用 | 安装 | 贡献 | 支持

使用

wp export [--dir=<dirname>] [--stdout] [--skip_comments] [--max_file_size=<MB>] [--filename_format=<format>] [--include_once=<before_posts>] [--allow_orphan_terms] [--start_date=<date>] [--end_date=<date>] [--post_type=<post-type>] [--post_type__not_in=<post-type>] [--post__in=<pid>] [--with_attachments] [--start_id=<pid>] [--max_num_posts=<num>] [--author=<author>] [--category=<name|id>] [--post_status=<status>]

生成一个或多个包含作者、术语、帖子、评论和附件的WXR文件。WXR文件不包括站点配置(选项)或附件文件本身。

选项

[--dir=<dirname>]
	Full path to directory where WXR export files should be stored. Defaults
	to current working directory.

[--stdout]
	Output the whole XML using standard output (incompatible with --dir=)

[--skip_comments]
	Don't include comments in the WXR export file.

[--max_file_size=<MB>]
	A single export file should have this many megabytes. -1 for unlimited.
	---
	default: 15
	---

[--filename_format=<format>]
	Use a custom format for export filenames. Defaults to '{site}.wordpress.{date}.{n}.xml'.

[--include_once=<before_posts>]
	Include specified export section only in the first export file. Valid options
	are categories, tags, nav_menu_items, custom_taxonomies_terms. Separate multiple
	sections with a comma. Defaults to none.

[--allow_orphan_terms]
	Export orphaned terms with `parent=0`, instead of throwing an exception.

过滤器

[--start_date=<date>]
	Export only posts published after this date, in format YYYY-MM-DD.

[--end_date=<date>]
	Export only posts published before this date, in format YYYY-MM-DD.

[--post_type=<post-type>]
	Export only posts with this post_type. Separate multiple post types with a
	comma.
	---
	default: any
	---

[--post_type__not_in=<post-type>]
	Export all post types except those identified. Separate multiple post types
	with a comma. Defaults to none.

[--post__in=<pid>]
	Export all posts specified as a comma-separated or space-separated list of IDs.
	Post's attachments won't be exported unless --with_attachments is specified.

[--with_attachments]
	Force including attachments in case --post__in has been specified.

[--start_id=<pid>]
	Export only posts with IDs greater than or equal to this post ID.

[--max_num_posts=<num>]
	Export no more than <num> posts (excluding attachments).

[--author=<author>]
	Export only posts by this author. Can be either user login or user ID.

[--category=<name|id>]
	Export only posts in this category.

[--post_status=<status>]
	Export only posts with this status.

示例

# Export posts published by the user between given start and end date
$ wp export --dir=/tmp/ --user=admin --post_type=post --start_date=2011-01-01 --end_date=2011-12-31
Starting export process...
Writing to file /tmp/staging.wordpress.2016-05-24.000.xml
Success: All done with export.

# Export posts by IDs
$ wp export --dir=/tmp/ --post__in=123,124,125
Starting export process...
Writing to file /tmp/staging.wordpress.2016-05-24.000.xml
Success: All done with export.

# Export a random subset of content
$ wp export --post__in="$(wp post list --post_type=post --orderby=rand --posts_per_page=8 --format=ids)"
Starting export process...
Writing to file /var/www/example.com/public_html/staging.wordpress.2016-05-24.000.xml
Success: All done with export.

安装

此软件包包含在WP-CLI本身中,无需额外安装。

要安装此软件包的最新版本,覆盖WP-CLI中包含的版本,请运行

wp package install [email protected]:wp-cli/export-command.git

贡献

我们感谢您积极为这个项目做出贡献。

贡献不仅限于代码。我们鼓励您根据自己的能力以最佳方式做出贡献,例如编写教程、在当地聚会中进行演示、帮助其他用户解决支持问题或修改我们的文档。

要了解更多信息,请查看WP-CLI的贡献指南。此软件包遵循那些政策和指南。

报告错误

认为您发现了一个错误?我们希望您能帮助我们将其修复。

在创建新的问题之前,您应该搜索现有问题,以查看是否已存在对该错误的现有解决方案,或者它是否已在新版本中修复。

在搜索一番并发现没有开放或已修复的问题与您的错误相关后,请创建一个新问题。尽可能提供详细信息,并在可能的情况下提供重现错误的清晰步骤。有关更多指导,请查看我们的错误报告文档

创建pull request

想贡献一个新功能?请首先打开一个新问题,讨论该功能是否适合本项目。

一旦您决定投入时间将pull request完成,请遵循我们创建pull request的指南,以确保这是一个愉快的体验。请参见"设置"以获取有关在本软件包本地工作的具体细节。

支持

GitHub问题不是用于一般支持问题的,但您可以尝试其他途径: https://wp-cli.org/#support

此README.md是从项目的代码库动态生成的,使用wp scaffold package-readme文档)。要提出建议,请提交针对代码库相应部分的pull request。