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

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

How to delete a single post using wp cli in command line?

Please read the docs. It’s wp post delete POST-ID. # Delete post skipping trash $ wp post delete 123 –force Success: Deleted post 123. # Delete all pages $ wp post delete $(wp post list –post_type=”page” –format=ids) Success: Trashed post 1164. Success: Trashed post 1186. # Delete all posts in the trash $ wp post … Read more

WP CLI: search and replace specific directory name of URL

Instead of using ” to wrap your expressions, use ‘. Further experimenting shows me that this is incorrect—both ” and ‘ should work, as long as they’re matched (ie, you don’t accidentally try something like wp search-replace “domain.com/wp-content/uploads/(\d)/(\d)/(\d*)/’ “domain.com/wp-content/uploads/\$1/\$2/” –precise –all-tables –skip-columns=guid –regex. (Note that the regex in that example starts with ” and ends … Read more

wp-cli only displays PHP version for all input options

Try running php wp-cli.phar EDIT It looks a little like php on your system isn’t setup to use php-cli (it’s using php-cgi instead): try running: php -v on my machine I get: PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with … Read more