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 […]
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!
If for some reason you can’t run wp db query, but need to export SQL output to a CSV or other file, then have a look at this small WP-CLI command I whipped up that should allow this:
With Wisps, you can have code snippets similar to Gist, Pastebin, or similar code sharing sites. Using the built-in WordPress code editor, you can write snippets to post and share.
Have you ever accidentally saved the same post meta to a post in WordPress, and ended up with a duplicate? Of course, you could go through each post and check the meta, check for duplicates, and delete any of them but… I think I’ve figured out a beast of an SQL query that will give […]
…or how I stopped worrying and learned to love the slashes. Post Meta in WordPress is a great tool to store random bits of data associated with your posts. But did you know that it comes with its own set of problems? Have you ever tried storing a JSON string inside of post meta? Only […]
If you’re hosting your WordPress website on DreamHost, and use their cron system to offload your WordPress faux-cron for better reliability, be careful of what version of PHP you have in your code. I recently had an issue where my cron events weren’t firing, and after enabling email output, I ended up with something like […]
An interesting problem I came across recently was how to set up a WordPress blog with an anonymous user. Now, a simple way would be to create a brand new user with fake information, but that’s too easy. After looking for some prior art, I found the Anonymizer plugin in the WordPress.org plugin repository. Unfortunately, it’s […]
WordPress has a built-in function called wp_safe_redirect(). This allows you to create redirects in code, but only to whitelisted domains (via the allowed_redirect_hosts filter). The downside to this is that you have to remember to whitelist the domains. It’s easy to forget if you’re doing a lot of redirects, for instance with the WPCOM Legacy […]
One of the best ways to ensure that a WordPress site–well any site really–stays performant and not broken is by leveraging caching. WordPress by default doesn’t do much caching other than some in-memory caching of objects, and the odd database caching via the Transients API. This site currently has three layers of caching: PHP OPcache […]