Limitations WP-CLI

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

I really like WP-CLI, but like everything in this world, it has its limitations. Sometimes, other tools (e.g., SQL) are better suited:

Max 100 items

Quite a number of WP-CLI command, return maximally 100 items from a set. Of course, that can be circumvented, but it's quite annoying and makes stuff more complicated. For details: Iterate over objects (WP-CLI) & wp wc product list » Get all IDs

Speed

Depending on the use case, WP-CLI sometimes is very, very slow. Even when doing stuff in parallel using e.g., GNU Parallel on a big server.

  • The trouble when stuff takes time, is that debugging becomes really hard
  • Sometimes, doing something in SQL, is like seemingly infinitely faster than using WP-CLI.

Update an arbitrary property of a set

It's in general not possible to update an arbitrary property of all items in a set - E.g., update the value for reviews_allowed for all WooCommerce products where this property has a certain value.

See Update all objects in a set (WP-CLI) for details.

Extraction - SQL?

Especially for extracting information from a WordPress instance, rather than adding or updating, SQL might often be preferable.

See also