Posts

Programmatically Create New Sites In WordPress Multisite

In WordPress, creating new sites from the admin interface can be tedious, especially if you want to add custom metadata to sites/ACF option fields. I had a scenario where I needed to create 1800 sites from a spreadsheet. Doing it one-by-one was not going to cut it, so I needed a code solution where I could loop through these sites and create them without needing the UI. Like almost everything in WordPress, there is a function you can call. It’s called wpmu_create_blog — I have a Multisite subdomain install, so this code won’t work for directory-based multisites (it’s not hard to change, though). And I found the documentation to be quite poor. But, here is what I ended up doing.

Unpkgd Is Down (Again)

After an outage seven days ago, unpkgd.com, a widely used CDN for NPM packages, is again down. This time, the outage is more severe. At the time of writing, unpkgd.com has been down for hours. Even the official status page is down. With two outages in such a short period, I am starting to doubt whether I will continue to use unpkgd in the long term. It’s a free service, so I can’t complain really. But, it does highlight the fragility of relying on free services.

A simple solution to Netflix's subscriber loss: stop cancelling TV shows

If I had a dollar for every time my wife and I discovered a great show on Netflix only to discover it was cancelled after one or two seasons, we would be stupidly rich. Netflix recently revealed they’re losing subscribers. You probably already knew this because you’ve either cancelled your Netflix account, considered cancelling it or seen the numerous news stories about their untimely demise. What some people don’t realise is Netflix, like other companies, pulled out of the Russian market over its unwarranted invasion of Ukraine and lost 700,000 paid subscribers. Between April and July, Netflix lost one million subscribers.

Fixing the color-adjust shorthand is currently deprecated warning in Autoprefixer

As much as I love front-end development, the ecosystem can sometimes inflict unnecessary pain. Given the front-end ecosystem relies on very few packages for a lot of modern development, when something changes and packages that rely on those don’t update: it’s a disaster. One such issue is Autoprefixer. You most likely arrived here searching Google for the error message: autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.

How to change the theme directory on a WordPress installation

The beauty in WordPress is not only its ecosystem. It’s the ability to customise almost every facet of it using a filter or hook. I had a scenario recently where I wanted to put a web application theme in a less painful directory to access. I wanted a folder called themes in my root directory. Instead of wp-content/themes/my-app-theme I wanted themes/my-app-theme instead. The structure resembles something like this: themes my-app-theme wp-content wp-includes index.php wp-config.php

Thoughts on Bun

Say what you will, but since its introduction in 2009, Node.js has been the undisputed king of server-side Javascript. Created by Ryan Dahl, Node.js had virtually no competition for years. Until recently, the only person to truly challenge Node.js was Ryan Dahl with his runtime Deno that improved upon some of the flaws that Ryan saw in Node.js which that were systematic and difficult to fix. Well, there is a new competitor NOT written by Ryan this time called Bun. Who said 2022 had no surprises left?

Fixing mysqldump unknown table COLUMN_STATISTICS

I am by no means a database guy. I am barely even a server guy. But, recently, I was tasked with exporting a sizeable database from Amazon RDS for use with local development servers. After running the following mysqldump command: mysqldump --host hostname -u username -p dbname > dbdump.sql I am asked for the database password and then proceed to get an error complaining about an unknown table called COLUMN_STATISTICS. Unknown indeed, I had no idea what this table was even for or why mysqldump was trying to query it.

The metaverse is a scam

There’s been a lot of talk about the metaverse over the last year. According to its advocates, it will be a revolutionary new platform that will let us interact with each other in ways we never could before. But is the metaverse all it’s cracked up to be? I’m not so sure. Admittedly, I don’t really know what the metaverse is supposed to be. Is it a virtual world, or is it a social network for VR headsets? Is it a term to describe a bunch of different futuristic concepts? There doesn’t seem to be a clear definition as to what it is even supposed to be. But, everyone is excited nonetheless.

Is your LinkedIn feed predicting a recession?

In my LinkedIn feed of late, I see a lot of layoffs. Most of those layoffs are talent acquisition roles, some development and design, but largely talent acquisition. If you’re not familiar with the role of talent acquisition, it’s a fancy way to describe an internal recruiter, someone who seeks out candidates for a company. Well, Twitter just laid off 30% of its talent acquisition team. While the exact number isn’t known, 30% is quite a sizeable percentage of people to layoff as Twitter is amidst a hiring freeze and cutting back on new hires.

Do Developers Rely Too Much on Frameworks and Libraries?

In recent years, there has been an explosion of front-end development frameworks and libraries. While this has made development more manageable and efficient, it has also led developers to become increasingly reliant on these tools. As a result, when something goes wrong with the library or framework, it can be difficult to determine the source of the problem and fix it. You can cross your fingers and hope someone in a comment on a GitHub issue has a workaround or there is a pull request with a fix. But, I’ve seen how fragile the front-end ecosystem can be when a single library lags behind the updates of other packages it depends on and things can quickly fall apart.