Ok, so I have been using wp plugin update --all in the past with a tee command. There has been no problem in the past, but after I ran an update on my system, everytime I run the command through a pipe, the formatting is messed up. So this is the gist of the command used: wp plugin update --all|awk '/Success/,EOF'| tee >(convert -font Courier -pointsize 14 label:@- img.png) Previously it would produce a flawless output: enter image description here

However, now when I pipe, even if I leave out the convert command, say something like this: `wp plugin update --all | tee test.txt' the output is messed up.... enter image description here


enter image description here

Has anyone got any ideas....driving me a bit crazy...

2 Answers 2


WP CLI needs to know some things about the terminal it's running in to format the table, aka the TTY.

But when you pipe, there is no TTY!

But you can trick it into thinking there is if you use this bash function:

faketty() {                       
    0</dev/null script --quiet --flush --return --command "$(printf "%q " "$@")" /dev/null

then you can run WP CLI commands and it will think it’s running in an interactive shell, not a pipe, e.g.:

faketty wp post list | more
  • Hi Tom. Thanks this did definitely help and worked! Thanks so much for the answer. I think what got me, was that it was working before, and then suddenly it stopped. Not sure if this was a change on the wp cli side of things? Anyway, I'm just grateful that it's now working - awesome help!!!!
    – Neural_oD
    Commented Apr 16, 2021 at 7:11
  • WP CLI maintainers will be able to answer that either on their github or in the WP CLI slack channel on the official WP slack
    – Tom J Nowell
    Commented Apr 16, 2021 at 11:21

You can use the SHELL_PIPE ENV variable to preserve the ascii format, according to the WP-CLI docs:

To enable ASCII formatting even when the shell is piped, use the ENV variable SHELL_PIPE=0.

For a single WP-CLI command this might be sufficient, e.g.:

( SHELL_PIPE=0; wp plugin list > list.txt )


( SHELL_PIPE=0; wp plugin list | less )

to preserve the ascii table format when piping. This answer is helpful regarding subshell.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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