WP-CLI can not find Url

Short answer: Read the documentation. Long answer: WP CLI needs to know your WordPress root directory. That is not platform, but software specific. This is also needed in Multisite and Network installs to determine the current site. The easiest way to solve this is to use a YAML configuration file for WP CLI. Best is … Read more

Resetting internal WordPress state during its cycle

The general answer is “no”. WordPress has too many globals (and new ones are being added in every new release 🙁 ) to be able to “reset” the general state in a sane way, and there is no “api” to do that. (and this without even talking about themes and plugins which are a can … Read more

Specify custom php.ini to use with WP-CLI

If executing PHP scripts directly on command line, you can try the -d option. Another way is to make use of the WP_CLI constant: if ( defined(‘WP_CLI’) && WP_CLI ) { // Load custom PHP configurations here. }

Bulk remove custom post type and its attachments with wp-cli?

To do this, you could use wp post list and pipe the output into wp post meta delete using xargs. Here’s an example command to delete the featured images in the meetings post type: wp post list –post_type= meetings –fields=ID –format=csv | xargs -I % wp post meta delete % _thumbnail_id You can use wp … Read more

Set Site Icon programmatically (eg. using `wp cli`)

The ‘official rules’ about site icons are here:https://www.w3.org/TR/html5/links.html#link-type-icon . They provide this example of site icons for several sizes: <link rel=icon href=favicon.png sizes=”16×16″ type=”image/png”> <link rel=icon href=windows.ico sizes=”32×32 48×48″ type=”image/vnd.microsoft.icon”> <link rel=icon href=mac.icns sizes=”128×128 512×512 8192×8192 32768×32768″> <link rel=icon href=iphone.png sizes=”57×57″ type=”image/png”> <link rel=icon href=gnome.svg sizes=”any” type=”image/svg+xml”> The above link also specifies if the ‘link … Read more

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