WPCLI doesn’t recognize the site

There is only one function in wp-cli which will return this error and it is wp_not_installed wp_not_installed definition. as you see function is checking if your site is installed by calling function from WordPress core is_blog_installed. is_blog_installed definition. It is hard to tell what is happening exactly with your site but I would try to … Read more

Userless db-only wordpress instalation

It is not possible to install WordPress without creating a user. However, you could immediately remove that user with a second wp-cli command like yes | wp user delete 1 Note: this will also delete any posts and pages associated with that user. You can normally re-assign them to a different user but in this … Read more

wp-cli PHP Notice after moving server behind load balancer

Check if isset() first. It will not always be set (that is what the undefined index is referring to): I took this from user temuraru $isSecure = false; if (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] == ‘on’) { $isSecure = true; } elseif (!empty($_SERVER[‘HTTP_X_FORWARDED_PROTO’]) && $_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’ || !empty($_SERVER[‘HTTP_X_FORWARDED_SSL’]) && $_SERVER[‘HTTP_X_FORWARDED_SSL’] == ‘on’) { $isSecure = true; … Read more

How to run wp cli from a wp hook?

Depends on what you want to do. If you want to run the PHP code that’s behind the WP-CLI code you might consider looking at https://github.com/wp-cli/entity-command Maybe you don’t actually need WP-CLI but the corresponding code behind it. Most WP-CLI commands have WordPress equivalents. For example of what I was trying to do today, the … Read more

WP-CLI media import error

I figured it out, with some help. You have to be on the same server where the files are located to use wp media import. The steps are: Log out of ssh connection Log into the remote server using sftp Upload the files using sftp, then log out Log back in using ssh Then you … Read more

wp_clear_object_cache() is deprecated. What should I use instead?

The function wp_cache_flush() should help you but is not the same one. The function runs on the global $wp_object_cache and set a new empty array, different to the WP CLI deprecated function wp_clear_object_cache for different keys of the global var. function wp_clear_object_cache() { global $wpdb, $wp_object_cache; $wpdb->queries = []; if ( ! is_object( $wp_object_cache ) … Read more

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