Tom McFarlin

Software Engineering in WordPress, PHP, and Backend Development

Page 3 of 426

Maybe ChatGPT Didn’t Wreck Our Type of Content

To say that 2024 has been a year would be an understatement. Though I’m talking about things that have happened offline, the same can be said for the WordPress economy at large, too.

On a regrettable level, the degree at which I’ve written has decreased more this year than likely any other year since I’ve been writing. Some of this can be attributed to stage of life, some can be attributed to work, and some of this can be attributed to the rise of AI in our industry.

AI taking a bite out of WordPress (or something like that).

Over a year ago, I wrote that ChatGPT Wrecked Our Type of Content in which I claim:

Though the goals of this question are not mutually exclusive, I think getting an answer fast often outweighs the “I’m looking for an answer but it was neat to also read about someone else’s situation while searching for it.” And this is why ChatGPT has “wrecked” some of the content a bunch of us typically write.

But, as stated, it’s been over a year since this was written. And since I work in R&D in my current role, we’ve done – and continue to do – a lot of work with the various systems, applications, utilities, and so on.

Given that, I – like many of you – have recalibrated my perspective on how this changes the work we do.


ChatGPT Didn’t Wreck Our Type of Content

Improved Productivity

First, it’s undeniable that when used properly, AI assistants can vastly improve productivity. I run both Copilot and Cody in my editor as I’m consistently evaluating which one performs best for a given use case. At the time of this writing, I’m partial to Cody though I also know Copilot is going to support multiple LLMs in the coming months (or weeks?).

So, sure, AI assistants have changed the way the work in our day-to-day but, as the months have passed, I’m no longer convinced it’s “wrecked” our type of content so much as it’s “drastically altered” how we explain – for lack of a better word – our content.

One of which is more neutral than the other.

Large Context Windows but Lacking Context

Secondly, for as much as I typically work with ChatGPT, Gemini, and/or Claude (is there a clever acronym for all of these, yet?) on a daily basis, I find myself continuing to enjoy well-written content either in newsletters (see The WP Minute, The Repository, or Within WordPress) or blogs (see Brian Coords, what Mike is doing over with Ollie, and so on). Though I’m but one person, each of these properties or people continue to publish even though LLMs are available for any of us to use.

And that brings me to the final point: There are reasons AI hasn’t completely wrecked the type of content I – and others – have often published:

  • AI hallucinates. Recommendations provided within a given LLM are presented with an authoritative sense regardless of if the recommendations even use hooks, function names, or language features that don’t exist.
  • Lack of context. LLMs do not have the context as to how a given developer arrived at a solution and why one was chosen over another. Sure, you can ask for a variety of solutions and tradeoffs but there are times in which it’s still faster to read from someone who’s had the same experience, shared it, and provided contextual information as to how and why they arrived at a solution.
  • Aggressive Autocomplete. I’m a fan of using coding assistants within my IDE. As I said, the level of productivity and speed of solving problems has definitely increased, but that doesn’t mean its attempts to autocomplete a piece of functionality are always helpful. It still takes a critical eye to review what’s being proposed and determine whether or not it’s worth integrating.

There are likely more and your experience likely varies – but I suspect aren’t much different – from mine.

The Why Behind the How

The reason I share all of this is because one of the fundamental things that is missed when working solely with AI is the value that human beings bring to the table when sharing the why behind the how.

This is not me taking a position on whether or not AI will, can, should, or whatever other argument is the current hot topic replace humans. Instead, it’s me saying that although I appreciate the value AI has brought to our industry and I recognize it alters the need for certain types of content, I no longer think it completely negates or replaces the type of content about I – and others – used to write.

Sure, our approach may need to be tweaked but there’s still plenty of ways to regularly share what we’re working on, how to solve a certain problem, and why one solution was chosen versus another.

Finishing 2024, Into 2025

Given that 2024 is coming to a close in the coming weeks and that we seem to have accepted the role AI plays in the day-to-day work of software development, perhaps I can start writing somewhat regularly once again.

There’s no shortage of things I’ve built, learned, saved, and archived. And while others have continued to publish their stuff, I’ve missed doing the same. Perhaps the coming weeks – and coming year – is a time in which those of us who so frequently wrote about development can find our way to back to doing exactly that.

Maybe with a few alterations, though.

Fetch Album Artwork for Apple Music Playlists

TL;DR: I often create playlists for entire albums within my Apple Music library. This means that if an artist releases an album, I’ll still add it to my library, but I like to have a playlist of just that album. Unfortunately, Apple Music doesn’t use the album’s artwork as the image for the playlist.

So I wrote a Python script to fetch album artwork for Apple Music playlists when given an artist and an album. This makes it a little bit easier to make sure album playlists have better looking artwork.


Fetch Album Artwork for Apple Music

Whenever we create playlists within the current version of Apple Music, it gives us the ability to create playlist art that seems to be inspired by the Microsoft WordArt of decades past.

It’s certainly a choice. And for whatever reason, Apple Music doesn’t default to the album artwork for the album in the playlist if it’s just a single album.

Apple Music does allow us to add custom artwork, though. So if I want to add the album artwork for a given album in a playlist, then I can search the web for a high-resolution image and drop it into the editor for the playlist.

Perhaps a better option, though, is to grab the image artwork from the iTunes API. So I wrote a Python script that makes it trivially easy.

After it’s installed, all you need to do is issue the following in your terminal:

$ python fetch-album-art.py --artist="Pink Floyd" --album="The Dark Side of the Moon"

This will grab a high-resolution image of The Dark Side of the Moon and drop it into the script’s directory after which you can add it to Apple Music.

Future State

Assuming Apple doesn’t actually address this in a future version of Apple Music (which, if history is any indication, happens with each official macOS update), then this is something that’ll prove useful [at least for me] for the next little while.

That said, I’d still like to find ways to enhance the functionality so:

  • album artwork is added to its own directory,
  • considering combing through an Apple Music playlist library to determine what albums don’t have artwork (this is subject to the limitation of the API, obviously),
  • provide better visual feedback when the script is searching and downloading the album artwork,
  • and small tweaks like that.

Given that it’s a hobby project, though, it’s one of those that’s subject to the whims of when I want to work on it.

For now, though, this is still one step better than having to find an image via a web browser, download it, then drag it into Apple Music.

Fix: Reschedule Event Error for Action Scheduler

TL;DR: If you’re using WordPress 6.1+ and aren’t able to schedule any type of job with Action Scheduler, this article explains the problem and a potential fix.

Specifically, this seeks to address the following message appearing in WordPress 6.1+:

Cron reschedule event error for hook: action_scheduler_run_queue, Error code: invalid_schedule, Error message: Event schedule does not exist., Data: {"schedule":"every_minute","args":["WP Cron"],"interval":60}

Resolve the Reschedule Event Error

Introducing More Logging

Starting in WordPress 6.1, additional logging was added to WordPress core. Specifically, the patch responsible for this includes the following description:

Rarely and randomly some of my custom cron events have disappeared. From searching around, I’m not the only one with this issue, and no one else was able to figure out why. I also was unable to debug the issue since wp-cron.php doesn’t log any errors nor have any hooks to try handling them. This patch adds those in.

trac

Once this patch was introduced, it also resulted in others experiencing issues with cron and cron-related libraries starting from this ticket and then taking place in a specific forum post.

When you’re trying to create a schedule but it keeps blowing up.

And sure, these tickets are helpful as are the comments and the rest of the discussion in the forum. But there are times when we’re working on a specific task with a specific set of dependencies and need a specific solution.

Action Scheduler and Cron Jobs

My problem was this: I was trying to to register a job using Action Scheduler and the library wasn’t able to register the schedule because of the aforementioned problem.

So the fix was to add this function in my code:

/**
 * Additional logging in WordPress 6.1+ that generates the following
 * message regarding cron schedules:
 *
 * Cron reschedule event error for hook:
 * action_scheduler_run_queue,
 * Error code: invalid_schedule,
 * Error message: Event schedule does not exist.,
 * Data: {"schedule":"every_minute","args":["WP Cron"],"interval":60}
 *
 * This function needs to fire prior to loading Action Scheduler as its a
 * pre-requisite for it to schedule our tasks.
 *
 * This filter seeks to manually add the schedule to the list of schedules to
 * address this bug.
 */
add_filter('cron_schedules', function ($schedules) {
    $schedules['every_minute'] = [
        'interval' => 60,
        'display'  => 'Every Minute',
    ];
    return $schedules;
});

A few things about this code:

  • I don’t recommend using this as a permanent fix for every case. It’s a specific solution for a generic warning.
  • If your codebase is going to be distributed to wide audience, avoid anonymous functions. If you have control over the environment in which it will return, it may be fine.

On the other hand, if you’re using Action Scheduler, WordPress 6.1+, and are trying to register your own jobs and are seeing this message, this will ensure schedules Action Scheduler uses are available.

How to Successfully Deregister Anonymous Functions in WordPress

When I first started writing about anonymous functions in WordPress back in January, I didn’t anticipate it spanning over three articles reaching into the fourth month of the year. But here we are.

That said, this final article in the series aims to help provide a short introduction to a number of technical ideas both in PHP and WordPress to explain why deregistering anonymous functions is nearly impossible.

And it provides a way for us to actually get contextual information about every single hook and callback in an instance of WordPress so we can handle the anonymous functions as we see fit all through the use of a plugin.


Recall from the first article, the reason I started writing about anonymous functions in WordPress all stemmed from a tweet (or post or whatever they are currently called) that stated:

I do wish developers would stop using WordPress hooks with (what I think are called) anonymous functions […].

They are very hard if not impossible to unhook.

And the short of it is that it’s true: Anonymous functions are easy to register against WordPress hooks and are difficult to deregister.

But it’s not impossible.

Continue reading

You Probably Don’t Need An Elaborate Task Management System

At this point in my career, I’ve been working remotely more than I have ever been in an office. I don’t ever want to have to return into an office unless it’s absolutely necessary.

Part of working like this, though, is maintaining a sense of self-discipline for the backlog of tasks required for work and doing so in such a way that makes it easy for me to focus on what I’m working on, what’s next, and what’s in the backlog. (If you’re a developer and you’re reading this, then you’re probably thinking kanban and you’re not wrong – but what I’m getting at is slightly different).

Before getting too much into the rest of the article, I do want to share that the majority of work I do right now is captured in Asana and organized by quarter. We have very little email and very little thrashing between emails, DMs, and other behavior commonly associated with the hyperactive hive mind.

[The] hyperactive hive mind as a workflow centered on ongoing conversation fueled by unstructured and unscheduled messages delivered through digital communication tools, like email and instant messenger.

Ezra Klein Interviews Cal Newport

But that doesn’t mean I don’t want to take a little further to not only help my day-to-day (especially during periods of increased business) but also to help give visibility to other people with whom I work so they know where a given task stands in my queue.

And don’t think this is me elevating my day-to-day any more important than yours. On the contrary. I’m sharing this to help give insight on what I’ve found that works so it may help you, too.

Continue reading
« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑