wp-cli / export-command

Exports WordPress content to a WXR file.
MIT License
12 stars 27 forks source link

The third example doesn't work (post__in should be comma-separated post IDs.) #65

Closed DrLightman closed 6 months ago

DrLightman commented 4 years ago

Bug Report

Describe the current, buggy behavior

Here, there are listed three wp export examples. The third is broken:

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

Because the subcommand returns the list as a space-separated list of ids, whereas --post__in expect the list to be comma-separated.

Here is my output:

D:\Siti\wordpress>wp export --max_file_size=-1 --with_attachments --post__in="$(wp post list --post_type=post --posts_per_page=-1 --format=ids --category_name=subcat)"
Warning: post__in should be comma-separated post IDs.

Output of the subcommand alone is, infact:

D:\Siti\wordpress>wp post list --post_type=post --posts_per_page=-1 --format=ids --category_name=subcat
82 80 78

I know this is not strictly related to the export command, but I suppose it makes sense to post it in here since the example has been found in its page.

That said, I'd really liked that example to work because I needed to overcome the fact that --category doesn't seem to work and I decided to generate a list of post ids belonging to the category and pass it via the subcommand. :(

ernilambar commented 7 months ago

Ref: https://github.com/wp-cli/export-command/blob/main/features/export.feature#L207

Since we have been supporting both comma separated and space separated IDs in --post__in, example should be fine.