You can pretty easily customize the advanced custom fields WYSIWYG toolbars globally, however doing so on a case-by-case basis needs to be done in JS since the editing experience is so dynamic. This code is looking for a specific ACF field called step_text and sets the WYSIWYG editor to only…
YouTube’s hidden “Crane Kick” mode
I’m guessing this is from their Karate Kid thing a couple of years ago, but the YouTube CSS still includes references to a crane kick file: https://www.gstatic.com/youtube/img/originals/ckee/[email protected] To activate, you need to add a custom attribute of ytp-scrubber-container to some parent of .ytp-scrubber-container and then you’ll need to also manually…
How to install a specific version of Drupal using composer
When you are migrating a site from a legacy install of Drupal to a composer-based one, sometimes it is easiest to just get a new install running, add all of the modules using composer, then importing to the database so that Drupal just “wakes up” without realizing anything has changed….
How to create a command that holds other commands in wp-cli (WordPress CLI)
Almost every major site I work on has at least one custom wp-cli command that I’ve built to manage or automate things. But I always run into the same problem, I don’t want my command to be a root command, I want it to live in a namespace of my…
How to move a Google Analytics property without admin access to both accounts
If you have a Google Analytics property that you want to transfer to a different account, you need to be an admin (technically have Edit Property permissions) on both accounts, and there’s no way around this. So, how can you move an account if you don’t want to grant admin…
mySQL Recursive CTE
Almost 10 years ago I asked this question on Stack Overflow about how to find the deepest nodes in a recursive table using a Common Table Expression (CTE). Fast forward to today, and I need a mySQL equivalent, specifically for MariaDB. Please read the original question to get the gist,…
WPDB Insert automatically changing string format to number
The third parameter to wpdb::insert() is an array of formats that defaults to %s unless they are overridden in wpdb::$field_types. This is last part is very important. When WordPress boots, it statically sets that list to fields that should always be numbers unless someone specifies an explicit format as the…
WP 5.3 – Breaking changes
This is pretty big, and Iām guessing that a good number of people that have WP_DEBUG_LOG turned on (like me, sorry Scott) might see it filling up fast when 5.3 lands, and there might be some fatal errors, too. The discussion is here: https://core.trac.wordpress.org/ticket/47678 The gist is that they are…
Turn on spellcheck for any web page
Bring up the console and enter these two: document.body.contentEditable=’true’;document.body.spellcheck=’true’;
MySQL DUAL table
Here’s code that should work on any MySQL server regardless of databases and tables: SELECT 1 FROM DUAL Apparently they copied it from Oracle.