Automatically Delete Expired WordPress Transients using WP-CLI

WordPress plugins and themes can store a lot of temporary data known as transients. By default these transients are stored in the wp_options table and can accumulate rather quickly. Recently on codeable I cleaned a site with 58000 expired transients that were causing the database to crash daily. Due to an idiosyncrasy in WordPress core, … Learn more…

Remove Google Analytics utm Query String with nginx

Using Google Analytics to gain traffic insights for your WordPress or WooCommerce site can track visitors and conversion rates. If you use tracking for email blasts when you publish new posts or product deals, you may find visitors get a slower experience. Google Analytics adds a query string that looks something like ?utm_source=mailchimp which bypasses any caching you … Learn more…

Use Monit to Monitor + Restart MySQL Service Automatically

Monit can be used to monitor your services on your VPS or dedicated server. You can use Monit to make sure MySQL (MariaDB, Percona etc) is always running in case it crashes because of bots brute forcing or it runs out of resources. Monit will check the MySQL process by looking at the unix socket it is … Learn more…

Batch Lossy Compress PNG with pngquant Linux Command Line

Image optimization is critical for high performing websites. The smaller your images are the less space they take up which is great for desktop and mobile users. Lossy compression yields smaller file sizes than lossless compression. Lossy Compression of PNGs can be done with pngquant hosted on github. This guide will show you how to batch … Learn more…