wp-cli / export-command

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

Only add needed user when filtering by `--author` #88

Closed schlessera closed 3 years ago

schlessera commented 3 years ago

Instead of adding all users unconditionally, only add the one user that is needed when filtering by a specific --author.

Fixes #67

pjv commented 3 years ago

@schlessera I’m not sure if I am understanding correctly what this patch is supposed to do, or if I am using the export cli command correctly, but if I do and I am, then this patch doesn’t seem to be doing what I think it should be doing.

Here’s my steps and my results:

  1. I updated wp cli on my test site to 2.5.0
  2. I installed the latest master version of export-command over that by doing wp package install git@github.com:wp-cli/export-command.git
  3. I tested the resulting output by exporting a single page from the test site where that page is the only page authored by a specific author using a command like so wp export --post_type=page --author=<my-userid> --skip_comments --stdout > page.xml

The resulting file (page.xml) has thousands of <wp:author> items in it. I expected that it would only have the one for my-userid.

Am I misunderstanding this patch or doing something wrong?

pjv commented 3 years ago

Hello @schlessera ^^

schlessera commented 3 years ago

@pjv This patch is not part of the v2.5.0 release. To test it, you'll need to use the latest nightly version of WP-CLI. You can update to the latest nightly version with the following command:

wp cli update --nightly
pjv commented 3 years ago

@schlessera Thank you, but shouldn't doing this:

wp package install git@github.com:wp-cli/export-command.git

override the built-in wp cli export command with the current master branch of this repo?