“Class ‘Phar’ not found” error setting up WP-CLI with Cygwin

You are missing the Phar extension or it’s not enabled. Which version of PHP are you actually running? Check it with php –version. The Phar extension is bundled with PHP as of PHP version 5.3.0, and enabled by default. See https://www.php.net/manual/en/phar.installation.php. Your best bet is to upgrade PHP to at least PHP 7.1. Alternatively follow … Read more

Shortest way to install WP-CLI

Downloading the Phar file is the recommended installation method for most users. As you showed, it’s basically just one line. It can’t really get shorter than that. And the steps make sense: download the file, make it executable and move it to the right location. There are alternative ways to install WP-CLI though. For example, … Read more

PHPCS: Strings should have translatable content

There are several things wrong with your code The is no need for translation there. The message should have been translated before it is being passed to that function. At that function there is actually no context at all to create any different translation than %s Escaping should happen at the output. You should escape … Read more

MAMP PRO WP-CLI Error: Error establishing a database connection

I noticed a typo in the original answer, but it did work for me in my .zshrc file. The typo was the end of the last line, it was missing the final / between the php version and bin directory #MAMP Madness export PATH=/Applications/MAMP/Library/bin:$PATH PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1` export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

wp-cli: wp term generate xxxxx – Error: ‘xxxxx’ is not a registered taxonomy

I figured out a way, although it feels a bit wrong. First test if the taxonomy exists (which it doesn’t… the first time at least), and then create it as part of the process… if (! taxonomy_exists($this->taxonomy_manufacturer)) { register_taxonomy($this->taxonomy_manufacturer, ‘product’); } if (! term_exists($manufacturer[‘name’], $this->taxonomy_manufacturer)) { wp_insert_term($manufacturer[‘name’], $this->taxonomy_manufacturer); } Caveat, register_taxonomy warns of impending doom … Read more

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