How can I bulk delete media and attachments using WP-CLI?
From the WP-CLI documentation about wp post delete: wp post delete –force $(wp post list –post_type=”attachment” –format=ids) See wp post list for additional information.
From the WP-CLI documentation about wp post delete: wp post delete –force $(wp post list –post_type=”attachment” –format=ids) See wp post list for additional information.
It seems like Cygwin doesn’t support inline environment variables, like Bash does. Opened a ticket: https://github.com/wp-cli/wp-cli/issues/1086
First, you have to do your PHP error settings in your php.ini file unless the PHP ini directives don’t list it as PHP_INI_ALL – which is the case for nearly error related definition. So I’m assuming you just misread something and set stuff to wp_settings.php instead of wp-config.php. The next point is that WP CLI … Read more
If we restrict us to the output of wp post list, then here’s a way to search for %test% within the post titles of published posts: wp post list –ignore_sticky_posts=1 –post__in=$(wp db query ‘SELECT ID FROM wp_posts WHERE post_title LIKE “%test%” AND post_status=”publish” AND post_type=”post”‘ –skip-column-names | paste -s -d ‘,’ – ) Here’s the … Read more
Yes, there is! I didn’t find it at first, but wp cli offers a command called eval-file which does what you want: $ echo ‘<?php echo is_wp_error(“foo”) ? 1 : 0;’ > example.php $ wp eval-file example.php 0
Got the same problem! Just switch the php version. On my server PHP5.6 was default for apache, while CLI was configured with PHP7.1. After installing WP-CLI, with wp –info I got this result: PHP binary: /usr/bin/php7.1 PHP version: 7.1.5-1+deb.sury.org~xenial+1 php.ini used: /etc/php/7.1/cli/php.ini WP-CLI root dir: phar://wp-cli.phar And when i used the wp core install command … Read more
I have been working on a simple and pluggable command line interface. The basic work is done but we now need to start writing more commands (and implement it in plugins). Please feel free to fork and contribute! You can find the code on Github.
WP-CLI now has native commands for it. # Activate Maintenance mode $ wp maintenance-mode activate # Deactivate Maintenance mode $ wp maintenance-mode deactivate See wp-cli/maintenance-mode-command for more information.
Generally, plugins have some functionality hooked onto the deactivation action. This could be clearing cache, resetting options, you name it. Therefore the best practice is to deactivate them first, so they have the opportunity to clean up and execute whatever functionality they have hooked onto the deactivate event. Now if the plugin is broken and … Read more
What you experienced may be some network level problem or someone temporary removed the download resources. For instance before the update. Most of the details you can get from the source code https://github.com/wp-cli/wp-cli. Plugin update function in there looks like this. function update( $args, $assoc_args ) { if ( isset( $assoc_args[‘version’] ) ) { foreach … Read more