Tag: WordPress
-
Stopping WordPress User Registration Spam
I’ve had a rash of user registration spam lately, and even though I’m sure the site is secure, it’s just very annoying. So I’ve whipped up a quick little hook that I’ve thrown in my mu-plugins to give me the ability to add email hostnames to a blocklist and disable user registration from them: There’s…
-
Gathering database performance with WP-CLI
Recently at work, my team was asked to help gather data about database server performance before and after an upgrade. To help with this, we collected a number of heavy database pages on some WordPress sites, dumped every query running to generate the page, and grabbed them to profile. I whipped up this quick and…
-
Limiting Featured Image Dimensions in WordPress
As a follow up to my last post about limiting file sizes during uploads, I had to come back to the problem with limiting image sizes for featured images. Not bytes this time, but pixel dimensions. Still being a bit of a block editor newb, this was an interesting challenge for me, and I was…
-
Half Baked Idea: Limiting WordPress Image Upload Sizes
If you want to be able to limit images (or any attachments) from being uploaded into the media library if they are too large, you can use the wp_handle_upload_prefilter filter to do this. Below is a really basic example I whipped up in a few minutes that I shared with a customer not too long…
-
Quick Tip: Get Size of Revisions in WordPress
One thing that you might not think of when watching the size of a large WordPress site grow, is unnecessary data in the database. With the introduction of the block editor years ago, there has been a large increase in the number of revisions a post makes when being edited. This can create a lot…
-
Cool WordPress Plugins: Embed Extended
If you saw my last post, you may have noticed some cool embeds. These are coming from the Embed Extended plugin. This plugin takes OpenGraph data and treats it more like oEmbed data for WordPress. It works great with the block editor as well!
-
Quick Tip: Script Debugging in WordPress
If you’re debugging core WordPress scripts, one thing you might run into is dealing with cached copies of the script. Due to how script-loader.php enqueues the core files, their versions are “hard coded” and short of editing script-loader.php as well, there’s a way to fix this via a filter: This will apply a unique ver…
-
Quick Tip: Disable WordPress Block Editor Fullscreen Mode
I don’t know why, but any time I edit posts on this site, the block editor always goes into fullscreen mode. Even if I disable it, the next time I edit a post or refresh, it goes right back. My preferences aren’t being saved. Oh well, we can fix that with some PHP! Many thanks…
-
Getting WordPress Database Size via WP-CLI
One WP-CLI command that I’ve found handy is this db-size command. It allows you to output a site’s registered database tables along with the data and index size in any format that WP-CLI natively supports, with multiple sort options: Here’s some example output from one of my test sites: Enjoy!