I have a bit of a moral problem with AI.
I hate how it stole data without compensation to build its databases, and now charges people for use.
I hate how it’s shit for the environment.
But I also use it day to day for work because it can do some things faster than I can. Imperfectly, but still, it’s like having a handy junior programmer who is up to speed on the latest techno brouhaha, but doesn’t have the scope or depth of thought just yet.
It can be a very useful tool, but it’s difficult to look past the practical issues.
All that said, I have been hearing a lot about how plugin shops and theme shops for WordPress will go out of business because of AI.
Hogwash.
AI Doesn’t Think
This summer, I was designing and building an app for work that used two languages (BigQuery and Laravel) I wasn’t familiar with, and two services (PlanetScale and GCP) I hadn’t used before. I sat down and wrote up what I wanted the app to do and more or less how I envisioned it working and I tossed that into AI to ask it to help me:
- Estimate costs based on data volume
- Estimate time to develop
- Construct a plan using Claude TaskMaster to keep it organized
- Write up a summary pitch
After a lot of back and forth and starting new chats to clear the memory, I had a decent plan and presented it. It’s pretty much as planned though we did learn and tweak as we went along.
Could AI have invented that without me?
No.
AI can do a lot of things, but it cannot invent from nothing. It needs prompt and the better your prompt, with the more details of the needs and wants of the project, the better it can help you create. But it cannot just decide “you know what, I need an app for X.”
Unlike a human, who can think about the moral consequences or the practical UX, an AI only knows what it knows from its limited info base, and cannot expand on its own.
A human will go “this sounds nice, but …” where an AI might ask you about the flaws but only as it knows them.
AI Is Great For Optimizing
Also this summer, I was looking at how slow LezWatch.TV is in the back end. Now I knew that this was due to how much cross data we save, and how inefficient WordPress is about storing it.
For example, adding a new character to the database will:
- update the character count for the actor(s)
- update the character count for the show(s)
- update the meta for the gender and sexuality of characters for the show(s)
- update the stats of characters for actors, shows, formats, death, etc
- adjust show(s) score
There’s a lot of other little stuff, but every save of character does that. And it’s slow.
So I thought “there must be a better way…” and I wrote up a list of everything. Then I asked Claude (the AI in my code editor) to review the character saving code and tell me where it was slow.
It listed everything I had, plus a couple more (shadow taxonomies, weird cmb2 <=>
taxonomy stuff) and with that, I dumped a summary into Gemini (Google) and said “Based on all this, is Action Scheduler a good idea? Tell me why, or why not, and propose alternatives.”
Now notice I came in with my own proposal!
This is key because it set the expectation that I knew “saving is part of the issue, so if I can schedule out post processing, then saving will be faster!”
AI Extends What We Can Do
This is where AI is great, it extends. After I moved things to the action scheduler, I thought about the other slow parts and decided to make my sql calls more efficient.
I know how to solve an N+1 issue (not redundancy, but the select problem), but the pain in the ass with WordPress is it tricks you!
Let’s assume $things
is a collection of post objects. And you want to loop through all those things to get the ones with a meta of ‘other’ and echo it.
foreach ($things as $thing) {
$other = get_post_meta($thing->ID, 'other', true);
echo $other;
}
Looks perfect, right? Simple. Fast. Easy.
Well it’s two of the three. When you have 100 post objects, it’s fast. It’s even fast at 1000. But when you get to 3000 … now you’re going to see things slow down, and Google will ding you for TTFB (time to first byte).
The fix?
$thing_ids = wp_list_pluck($things, 'ID');
foreach ($thing_ids as $id) {
$other = get_post_meta($id, 'other', true);
echo $other;
}
It doesn’t look much different, but the trick here is that instead of looping and getting all the post data, we’re just using the IDs for a faster lookup and echo.
This gets compounded when you use WP_Query
. Yes, it gives you the posts but if you also need their meta or taxonomy data, WordPress doesn’t load that in the same query. So you end up doing one query to get all the posts, and then one extra query for each post to get its related data.
That’s the N+1 problem: 1 big query + N small ones.
By writing direct SQL, I can grab posts and their meta/terms in a single query, instead of hitting the database over and over.
AI Solves With Directions
My father used to say that people think of AI like it works in Star Trek. Captain Picard says he wants “Tea. Earl Grey. Hot.” The replicator knows exactly what he wants and makes it. Geordi LaForge asks the Holodeck to make a Sherlock Holmes themed villain, capable of defeating Data.
Given the recent issues with guardrails on AI and it pushing people towards suicide, I can’t help but think Dad was 100% right and still is. People look at AI as a panacea. It will solve problems because it has access to all the information and can make the right conclusions.
It doesn’t.
While I used it to help me find all the speed issues, with my set parameters (saving, searching, etc), I can’t just say “make my site faster.” The amount of refining that happens, and sometimes straight up corrections on what is pretty basic dev work is how I know this. Any developer work their salt will tell you it’s not perfect.
What AI is great for refining, improving, and assisting.
It does not, cannot, think for itself. It will not propose to you “hey, I’ve been looking at the code you’re working on and I have an idea.” It will not solve the problem before you identify there is a problem.
AI is a tool.
Use your tool wisely.
But … can you make it better for the environment?