2

I am using the WP-CLI to manage my sites. I can run the following command

wp post list --fields=ID,mycustomfield

 ID   |  mycustomfield
-----------------------
 1    |  active
 2    |  active
 3    |  disabled
 4    |  active

I am trying to narrow this list down by only returning those which has mycustomfield as active

Any ideas how I can do this?

2

Managed to figure this out, you can pass --meta_key and --meta_compare arguments like this...

wp post list --fields=ID,mycustomfield --meta_key=mycustomfield '--meta_compare=active'

ID   |  mycustomfield
-----------------------
 1    |  active
 2    |  active
 4    |  active

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.