WP-CLI 导出会返回导出项目不需要的一堆作者

问题描述 投票:0回答:2

在 WP-CLI 中使用此命令时,我同时获得了 5 个想要的订单项目以及大约 100 多个不需要的作者:

wp export --dir=exports/ --start_date=2021-09-06 --post_type=shop_order --author=1 --skip_comments

为什么一开始就添加这些作者,他们与查询无关,有没有办法摆脱他们?

wordpress woocommerce wp-cli
2个回答
0
投票

尝试使用

--post_author=1
--user=johndoe
。请参阅 https://developer.wordpress.org/cli/commands/post/list/https://developer.wordpress.org/cli/commands/export/

# 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.

0
投票

我在@leymannx回答上做了一些工作,这最终对我有用

wp export --user="{username}" --author={userid} --post_type=post

当然,您可以随意添加其他过滤器,例如日期等。

© www.soinside.com 2019 - 2024. All rights reserved.