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

Generate Sub-Comments with WP-CLI [closed]

Currently it is not available in WP CLI. See https://github.com/wp-cli/wp-cli/blob/master/php/commands/comment.php#L136 If you want, you can have your own customized comment generation command. See command cookbook. http://wp-cli.org/docs/commands-cookbook/

WP CLI allowed fields?

The list of fields is available on the wp post list page. These fields will be displayed by default for each post: ID post_title post_name post_date post_status These fields are optionally available: post_author post_date_gmt post_content post_excerpt comment_status ping_status post_password to_ping pinged post_modified post_modified_gmt post_content_filtered post_parent guid menu_order post_type post_mime_type comment_count filter url

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