Count file types by extension

February 17, 2023

Retrieve a list of all files, by extension, and display a count of them.

Quick tip to access protected properties in PHP object

May 27, 2020

Calling an object that has a protected property that you need access to? This function will allow you to quickly access data stored in protected properties of PHP objects. Note: I tested this on PHP 7.4. It will likely work on other versions, but may need tweaking. Good developers will protect the internals of their

How to extract a single table from a MySQL sql file

June 18, 2019

Ever received a large MySQL dump file and only needed one table out of it? I ran across just this issue. The full database took significant time to import and I only needed a small subsection of the DB, just one single table. Rather than waiting for it all to import, I pulled together a

Find total number of post records on a WordPress Multisite in MySQL

August 3, 2018

I was recently asked for the total number of posts on a WordPress website. Normally as simple as looking at the number in the dashboard, however in this instance the WordPress install was a Multisite with nearly 100 sites. That would have taken far too long to do manually, but what about having MySQL do

Find and update WordPress posts with comments older than NNN days

March 12, 2018

I have a use case where I need to disable comments on posts in WordPress where the last comment was more than one year, or 365 days, ago. Posts can be found with this query: SELECT p.ID, p.post_title, p.post_date, p.comment_status, p.`ping_status` FROM wp_posts AS p WHERE p.ID IN ( SELECT c.comment_post_ID FROM wp_comments AS c