What tools respect `.distignore`?

This is file for WP CLI. the command dist-archive: wp dist-archive . Note that you need to install both WP CLI and this plugin: wp package install wp-cli/dist-archive-command

Can I create (or update) user password with WP-CLI by hash?

There is not “one command” in WordPress CLI that does the job: https://github.com/wp-cli/wp-cli/issues/2270 However using other commands, you can overide the user password directly in the database using the following: USER_ID=$(wp user list –login=”$USR_LOGIN” –format=ids) wp db query “UPDATE wp_users SET user_pass=”$HASHED_PASS” WHERE ID = $USER_ID;” First line is optional if you already know the … Read more

WPCLI search and replace variants for all tables

In a WordPress installation, a certain number of database tables are registered in the $wpdb object. To see what they are, you can run the WP-CLI command wp db tables. On my local WP installation, these are the $wpdb-registered tables: wp_users wp_usermeta wp_posts wp_comments wp_links wp_options wp_postmeta wp_terms wp_term_taxonomy wp_term_relationships wp_termmeta wp_commentmeta wp_blogs wp_signups wp_site … Read more

WP-CLI with theme: Uncaught Error: Class ‘WP_CLI’ not found

You’ll need to wrap your statement within a class_exists() check: function foo_command( $args ) { WP_CLI::success( $args[0] ); } if ( class_exists( ‘WP_CLI’ ) ) { WP_CLI::add_command( ‘foo’, ‘foo_command’ ); } This way, the command is only registered when the WP_CLI class exists — because the WP_CLI class will only exist when WP-CLI is running.

Is it possible to use WP-CLI via PHP-framework?

The WP_CLI class has a runcommand method that launches a new child process to run a specified WP-CLI command. According to the docs, you can use it like this: $options = array( ‘return’ => true, // Return ‘STDOUT’; use ‘all’ for full object. ‘parse’ => ‘json’, // Parse captured STDOUT to JSON array. ‘launch’ => … Read more

How do I update a nested option?

wp option does all you need. See wp option patch in particular. Updates a nested value in an option. Get a nested option value: $ wp option pluck ez-toc-settings auto_insert_post_types Set a nested option value (with an array): $ wp option patch update ez-toc-settings auto_insert_post_types ‘{“post”:”post”}’ –format=json

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