Setting boolean and array values using wp theme mod set

Funny how you find the answer just after posting a question. Posting here, in case someone comes looking for it.

As per @Kero’s comment above, that’s correct. The command-line option will only recognise strings.

There is however an eval-file command that can be used to achieve this (and now that I have discovered it, a lot more).

Here are the steps for achieving the goal I posted in my question, however as the eval-file WP CLI command can be used to execute a PHP file, we can code anything that we deem fit.

Step 1: Create a PHP file with the required code. In my example here, I added the following:

<?php
set_theme_mod('my_boolean_mod', false);
set_theme_mod('my_array_mod', array(1, 2, 3));

The above code will use the WordPress set_theme_mod function to create/update mods named my_boolean_mod and my_array_mod.

Step 2: Execute the above file using the WP CLI eval-file command

 wp eval-file my_file.php

That’s it. Hope this is useful!

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)