September 13

ChatGPT just saved my website

I was about to start my blog post for NerdWords (my newsletter… sign up here!).

I hit the “Add a Post” button, and [insert record scratch sound] —

Your site has a critical error. Check your email for more info.

Well then. Ain’t that wonderful.

The email was one loooong paragraph. Go ahead and read it if you like. I couldn’t.

Screenshot of an email from WordPress notifying the recipient about a technical issue on their website and providing error details for troubleshooting. Thanks to ChatGPT, they've saved my website by guiding me through the fixes.

Ain’t it cute how it started the doom-and-gloom email with a friendly, “Howdy!”

My heart began to race, as one’s heart would. I’m my own IT department, so there’s really no one to call. I’ve fixed problems like this before, but it’s always very painful for me.

Solving the Problem the Old Way: Google

My typical response to an error like this is to grab the error code and start Googling away. Rarely do we have problems that haven’t been addressed on a Reddit forum somewhere, sometime.

So off I went to start Googling, resigned to the fact that I would probably be messing around with this for a couple hours at least and would have to skip my newsletter this week.

Within 15 minutes I found a couple of discussions around similar problems, but it didn’t look like my exact problem. So my frustration and anxiety continued to grow.

Screenshot of search engine results displaying various forum discussions and articles about fixing the "E_ERROR" caused in line 36 of a PHP file, particularly related to WordPress code issues. One user mentioned how ChatGPT saved my website by offering a quick solution.

ChatGPT Helps with Code, Right?

I use ChatGPT for ideas, images, demos, first drafts and more multiple times a week. But I don’t know the first thing about coding, so it took a while for my mind to think about AI as a solution.

ChatGPT Explained the Coding Error

I almost heard the “ding” of my lightbulb moment as I remembered that ChatGPT and other generative AI tools are supposed to be skilled at coding. I pasted the indecipherable text from the warning email and asked ChatGPT a simple question, “What is happening here?”

Within two seconds, ChatGPT was there for me:

A PHP TypeError in functions.php of ThriveThemeChild during an in_array() call. The 2nd argument was null instead of an array, causing an error at line 36 with function_name "in_array". Thankfully, a quick tip from ChatGPT saved my website.

To be honest, I still had no idea what it was talking about, but hey, it seemed confident.

ChatGPT Offered a Solution

After it told me what the problem was, it offered this:

A screenshot of a saved document with steps to troubleshoot a function in PHP code that checks if a variable is `null` and addresses compatibility issues with website plugins. The highlighted PHP code snippet provides clear guidance.

Again, I am clueless about the coding stuff, but I did recognize a very important black box in the conversation.

PHP code snippet showing a conditional statement to check if a variable is an array and contains the value 'product_cat', followed by a placeholder comment for additional code. This technique saved my website from critical errors.

See in the top right corner where it says “Copy code”? ChatGPT has written the actual words I can copy and paste into the hidden lines of text in my site. (It always seems very dangerous to play around in the code, so I copy and paste the entire thing somewhere just in case I mess everything up.)

ChatGPT Provided the Right Code in about 20 Seconds

Again, I don’t know anything about coding, but I recognized that the first code ChatGPT gave me wasn’t terribly specific. So I ended up copying and pasting the original code from my broken site and asking for more help.

The new code looked like the solution, and it was! I simply copied it from ChatGPT and pasted the new code over the broken lines on my site. Poof. Problem solved.

A screenshot of code with an explanation. The code includes a check to ensure that `taxonomies` is an array before using it in an `in_array()` function, which saved my website from potential errors.

Figuring Out What Really Happened

So now that the problem was fixed, I really did want to understand it a little better without hurting my brain. So this was my final exchange with ChatGPT.

Screenshot of a text-based explanation detailing a website error related to a "product_cat" taxonomy in a list of taxonomies, and how adding a check to ensure they exist before use fixed the issue. This solution saved my website.

Problem Solved in a Fraction of the Time

Time this probably would have taken before ChatGPT: 2 hours

Time with ChatGPT: 10 minutes

What am I doing with the 1 hour and 50 minutes I just got back? Writing this as a case study for my newsletter.


Tags

business essentials, utility


You may also like

Noteworthy AI Stories

Noteworthy AI Stories
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>