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.

How to Backup, Delete and Restore a PostgreSQL Database in CentOS 7 or Ubuntu 16

Reading Time: 5 minutes

Listing databases
Dump a database
Dumping all databases
Dump Grants
Delete or Drop a Database
Delete a Grant
Restore a Database
Restore Grant
Continue reading “How to Backup, Delete and Restore a PostgreSQL Database in CentOS 7 or Ubuntu 16”

How To Remove a User from a MySQL Database in cPanel

Reading Time: 1 minute

This tutorial assumes you’ve already logged in to cPanel, and are starting on the home screen.  Let’s learn how to remove a user from a database.

  1. Click the “MySQL Databases” icon.cpanel-pl-mysql-7-removeuser-02
  2. In the table of databases, locate the database you wish to remove a user from, locate the specific user assigned to that database that you want to remove and click the delete icon.cpanel-pl-mysql-7-removeuser-04
  3. Click “Revoke User Privileges from Database” to confirm.cpanel-pl-mysql-7-removeuser-05
  4. That’s it! The user has been removed from the database.cpanel-pl-mysql-7-removeuser-06
  5. The user hasn’t been deleted … you can see it’s still listed in the list of current users. It has simply been removed from that database.cpanel-pl-mysql-7-removeuser-07

 

How to Remove (Delete) a User on CentOS 7

Reading Time: 1 minute
Users via Command Line 101: Basic User Interaction
I. How to Add a User and Grant Root Privileges on CentOS 7
II. How to Remove (Delete) a User on CentOS 7
Pre-Flight Check
  • These instructions are intended specifically for removing a user on CentOS 7.
  • I’ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ll be logged in as root.

Continue reading “How to Remove (Delete) a User on CentOS 7”

Remove Permissions for a MySQL User on Linux via Command Line

Reading Time: 2 minutes
Pre-Flight Check
  • These instructions are intended for revoking a MySQL user permissions on Linux via the command line
  • I’ll be working from a Liquid Web Core Managed CentOS 6.5 server, and I’ll be logged in as root.

Continue reading “Remove Permissions for a MySQL User on Linux via Command Line”

Grant Permissions to a MySQL User on Linux via Command Line

Reading Time: 2 minutes
Pre-Flight Check
  • These instructions are intended for granting a MySQL user permissions on Linux via the command line
  • I’ll be working from a Liquid Web Core Managed CentOS 6.5 server, and I’ll be logged in as root.

Continue reading “Grant Permissions to a MySQL User on Linux via Command Line”