Delete Posts and Comments from Action Scheduler

Reading Time: 2 minutes

The Action Scheduler is a background processing, queue job runner which is built into WooCommerce core. A number of plugins use the Action Scheduler, WooCommerce Subscriptions and WooCommerce Follow-Ups being two of the best known.

WP-CLI makes it easy to delete posts and comments which have been created by the Action Scheduler in WooCommerce. There may be cases where the Action Scheduler might create a large number of posts and comments on your live site, and you want to clear up the data from the site’s database.

 

Delete Comments from Action Scheduler

To delete comments created by the Action Scheduler, you can run this command:

wp comment list --field=comment_ID --'post_author'='ActionScheduler' --number=1000 | xargs wp comment delete --forceThe number can be increased if you have more comments that need to be deleted to 2000 or higher.

Delete Bulk Posts from Action Scheduler

To delete all of the scheduled-action posts, you can run this command:

wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 | xargs wp post delete --forceThe number can be increased if you have more posts that need to be deleted to say 2000 or higher.

Delete Scheduled Action Posts

To delete all of the scheduled-action posts with a post status of trash, you can run this command:

wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=trash | xargs wp post delete --force

Delete Bulk Scheduled Actions

To delete all of the scheduled-action posts with a post status of cancel,  you can run this command:

wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=cancel | xargs wp post delete --force

 

Using a mix of these commands, you will be able to delete posts and comments easily, using WP-CLI on your site. It will also keep your site database clean, allowing it to run more efficiently.  Take the work out of maintaining your WordPress site with our Managed WooCommerce product.  Our WooCommerce platform comes with free iThemes plugins curated especially for online stores.

8 WP-CLI Commands to Clean Up and Optimize your Site

Reading Time: 2 minutes

Want to clean up your WordPress site without having to add multiple plugins? By using WP-CLI, you can run many useful commands to helpfully clean up your database and elements related to your site. In this post, many of the most common tasks are covered:

Continue reading “8 WP-CLI Commands to Clean Up and Optimize your Site”

Rollback a Plugin or Theme Using WP-CLI

Reading Time: 2 minutes

WP-CLI makes it very easy to rollback plugins and themes as well as update plugins and themes on sites all from command line. This is useful if you see your site is broken by a newer version of the theme or plugin. In this article, we’ll be running through some valuable commands for rolling back your site.

If you need to rollback a plugin on a site to a previous version, you can find the previous version number from the development tab of the plugins listed on WordPress.org. To find the slug of the plugin, you will need to go to the WordPress.org plugins. In the case of Contact Form 7, the plugin slug is contact-form-7.

Note:
You can also find the plugin or theme slug by going to your WordPress files and typing in:
wp plugin list

wp theme list

Pre-flight

Rollback a Plugin to a Previous Version

If you need to test that the command is correct, you can always use the flag –dry-run at the end of the command:

wp plugin update contact-form-7 --version=5.0.5 --dry-run

In the following example, to rollback Contact Form 7, you can use this command:

wp plugin update contact-form-7 --version=5.0.5

 

Activate A Particular Version of a Plugin

If you need to install and activate a previous version of a plugin, run:

wp plugin install contact-form-7 --version=5.0.5 --activate --force

 

Update All Plugins

If the plugins you updated have been fixed and you now need to update all plugins, the example command is:

wp plugin update --all

Excluding A Plugin

If you want to update all plugins, but need to exclude a specific plugin (in this case WooCommerce), run command:

wp plugin update --all --exclude=woocommerce

 

Rollback a Theme to a Previous Version

If you did need to rollback a parent theme to a previous version, you could use this command example which would rollback the Storefront theme to version 2.4.0:

wp theme update storefront --version=2.4.0

 

Update Theme to Current Version Release

If you know wanted to update the Storefront theme on a site to the most current version, you could use this command example;

wp theme update storefront

 

Using a mix of these WP-CLI commands will enable you to easily rollback a plugin on your site, rollback a theme, or update all plugins. It will also update all plugins, but exclude a specific plugin from being updated.  Our Managed WordPress product comes with WP-CLI installed along with easy, automatic updates.  Check out how our Managed WordPress platform can streamline your work today!

What are Common Commands to Update WordPress Using WP-CLI?

Reading Time: 2 minutes

WP-CLI is a very handy set of commands. You can run anything that you would run in wp-admin on a WordPress site but from the command line. Useful commands which WP-CLI employs to keep WordPress core updated plugins including the default themes which come with WordPress.

Continue reading “What are Common Commands to Update WordPress Using WP-CLI?”

Setup a Development Environment for CentOS using cPanel

Reading Time: 4 minutes

Editing a website’s code is often needed to update a site, but doing this to the live website could create downtime and other unwanted effects. Instead, its ideal to create an environment especially for developing new ideas.  In this tutorial, we will explore creating a development site specifically for CentOS servers. Continue reading “Setup a Development Environment for CentOS using cPanel”

Setup a Development Environment in Ubuntu

Reading Time: 4 minutes

Often we want to edit our domain’s code, but on a production website, this can be dangerous. Making changes to the production site would not only allow all of the Internet to see unfinished changes but could also cause errors to display. As a workaround, we’ll create a testing domain or “dev” domain to work out any bugs and changes to the site.

As a warning, this is advanced technical work. It’s possible to make mistakes and cause downtime on your live domain. If you are not 100% confident, it may be a good idea to hire a system admin or developer to copy the domain for you.

Continue reading “Setup a Development Environment in Ubuntu”

Installing WordPress using WP-CLI

Reading Time: 2 minutes

WordPress has a great GUI based installation process however some use cases call for CLI! Or maybe you just feel more at home in a terminal, either way this article will show you how to get your WordPress site setup with just a terminal, WP-CLI, and maybe a sprinkle of SSH.

So first things first, if you’re doing this locally fire up your terminal and if you’re doing this on a server connect to it via SSH. Now that you’re in CLI you want to get into the folder you’re installing WordPress to. From there you can get things rolling in WordPress! Continue reading “Installing WordPress using WP-CLI”

How to Update WP-CLI

Reading Time: 2 minutes

WP-CLI is a command line tool for interacting with and managing WordPress sites. In our previous article on How to Install WP-CLI we covered the process of installing WP-CLI onto a server. We did this in a way that the tool would be accessible by any user on the server. This prevents the need for your users to install the tool locally.
Continue reading “How to Update WP-CLI”

How to Install WP-CLI

Reading Time: 3 minutes

WP-CLI is a command line tool for interacting with and managing WordPress sites. WP-CLI is very similar in functionality to what Drush provides Drupal. If you are already familiar with using cli tools then this will be quick to pick up on. If not, then it may be a good time to start learning.

In this tutorial we’ll learn how to install wp-cli on a server and learn some basics. With WP-CLI you can speed up common maintenance, automate tasks, or even take backups. Continue reading “How to Install WP-CLI”

Using WP-CLI With Your WordPress Optimized Template Site

Reading Time: 5 minutes

Using the Command Line Tools

Liquid Web’s WordPress Optimized Template servers come with a pre-installed set of command-line tools designed to simplify common site maintenance tasks. WP-CLI (WordPress Command Line Interface) can be accessed via SSH, and allows you to do nearly anything that can be done from within the WordPress admin interface. Continue reading “Using WP-CLI With Your WordPress Optimized Template Site”