No internet connection
  1. Home
  2. Ideas / Feature Requests

wpcli commands don't allow setting empty value

By @EvanK2020-03-24 19:28:45.652Z

The wpcli integration allows us to set individual options, but doesn't allow setting them to falsey values.

For example, setting baseHREFto an empty string or any of the boolean options to zero results in an error of "Missing required argument: <value>", which I've traced to the use of empty here:

After debugging it a bit, it seems that if an argument for the value is provided, it comes through (albeit in these cases as a zero length string or literal string zero character)...and if one is not provided, it comes through as NULL.

I propose that this should use an explicit null equality check instead of the empty function, eg: NULL === $value

  • 1 replies
  1. Leon Stafford @leonstafford2020-03-24 23:10:12.913Z

    Hi @EvanK,

    In the current V6, which it seems you're using, there is also an unset command in WP-CLI for WP2Static (this was code contributed by a user who faced similar issues a cpl years back).

    In V7, it should default to setting an empty string, or perhaps you can try setting ''.

    I recommend starting to use the V7 pre-releases, which offer a lot of improvements. Documentation is lacking though, so may need a bit of trial and error: