Search
Close this search box.

How I Created My First WordPress Plugin Using ChatGPT

I had always wanted to develop WordPress products, but whenever I tried to learn WordPress development, I would get distracted or frustrated after a few days. Classic Gen-Z, right?

This cycle of starting and stopping went on for months until I realized I didn’t need to know everything about WordPress before I could start building. I wasn’t preparing for a job interview, I just needed to dive in. With AI tools available now, I knew I could create any software as long as I used them effectively.

So, I started—and the story continues…

Inspiration and Idea Generation

I wanted to create something simple yet unique and interesting. So, I asked ChatGPT for ideas, but none of them felt original or exciting. I tried a few other methods to come up with plugin ideas, but nothing clicked.

Then, I asked ChatGPT again for more suggestions. One idea that caught my attention was “Sticky Notes for Admins” – a plugin that adds sticky notes to the WordPress dashboard, allowing admins to leave notes or reminders.

However, I discovered there were already similar plugins available, and my interest faded. But then I had a new idea: what if, instead of just admins leaving notes for themselves, they could send reminders or notifications to others within WordPress?

For example, on an LMS website, a teacher could send a notice to students, or a principal could send one to teachers. This could be helpful for any website with a large number of users.

Building the Core Features

I came up with the idea for the plugin on my own, but I wasn’t completely sure about the features. So, I asked ChatGPT for help, and it provided some great suggestions.

I made a few adjustments, and here’s the final list of features:

  • Role-Based Notifications: Admins or users with certain roles (e.g., teachers, principals) can send notifications to users in another role (e.g., students, teachers).
  • Dashboard Widget Display: Notifications appear in a clean dashboard widget, showing the time, date, sender, and message.
  • Notification Archive: Old notifications are stored in an archive, allowing users to review them even after they’re no longer active.
  • Read/Unread Status: Users can mark notifications as read or unread.
  • Priority Levels: Senders can assign priority levels (e.g., High, Medium, Low) to notifications, each level in different colors.
  • Auto-Delete Period: Senders can set a time limit after which notifications automatically delete (e.g., 24 hours, 1 week). (Not yet added.)
  • Email Notification: An option to send the notice via email and show it on the dashboard. (Not yet added.)

After finalizing the features, I asked ChatGPT to build the plugin with these specifications. Did it work perfectly? No, not at all.

If you plan on creating software using ChatGPT, there’s something important you need to understand. These AIs are capable of generating complex code, but they can’t do it all at once. It’s not a plug-and-play solution yet. You have to be clear and precise with your prompts and move forward step by step.

That’s exactly what I did. After the initial errors, I adjusted my approach. I’m not a professional prompt engineer, but I knew how to describe what I wanted. Here’s what I told ChatGPT after it messed up:

“You messed up. Let’s start with a basic version of the plugin. Just create a custom post type called ‘Notice’ where users can create notices, and display them on the dashboard widget.”

From there, things started to click. I may not have known much WordPress code, but I was very familiar with the dashboard, so I knew what I was doing.

Testing and Debugging

As the project progresses, ChatGPT sometimes loses context, leading to errors or causing other features to stop working. To prevent this, I started asking it after a few new additions of code, “Do you want to know the current state of our project?”

I would then provide the relevant file names and their code. You can also upload the entire folder as a zip file, but this isn’t recommended unless you have ChatGPT premium. The free use of the pro model is limited, and once you hit the limit, you’re restricted from using that model for a certain time.

If you use the upload feature, your chat will become accessible only with the premium model. You’ll either have to wait or start a new chat and re-explain your project, which is time-consuming.

Some issues were fixed with one or two prompts. However, there were others that ChatGPT couldn’t resolve properly, so I had to change my approach entirely or take a step back and try to fix them from scratch.

Even when you add features one by one, they’re not always completed in one prompt. Often, there are flaws, or a new feature breaks something else. So, it’s important to check everything each time you add new code.

I spent about 60% of my time debugging and testing. It wasn’t until I tried to upload the plugin that I discovered WordPress has a tool to check if your plugin meets their standards. 

They even have a checkbox where you confirm that you’ve tested your plugin with their tool and fixed any problems. My plugin had a lot of issues, so I had to go back and fix them all over again.

Releasing the Plugin

I’m not sure if there’s a market for this plugin since I didn’t do any research before making it. I’m not expecting much because it’s a niche product, but I enjoyed the process of building it.

Many features could be added to this plugin, and I might include them in a pro version. However, that will depend on whether this plugin gains attention. After a few revisions from the plugin review team, I got approved.

Here is my the link: Role-Based Dashboard Notices

Lessons Learned

Can you create a complete plugin with ChatGPT without knowing how to code? The answer is yes. However, you can’t just copy and paste everything blindly. You still need to understand the basics of what you’re doing.

If you’re like me and want to build your products but don’t know how to code yet, you have two options: either learn to code or start with AI. For me, the problem was getting frustrated because I didn’t fully understand the code or the logic behind it. As a result, I would just give up.

So, I decided to start building without fully understanding everything. At least this way, I wouldn’t waste time. I could feel that I was creating something with my name on it and it kept me motivated.

Of course, we still need to learn to code, but I believe that by staying around code, I’ll eventually become familiar with the logic and syntax. It’s like a “learning by building” approach.

Also, patience is crucial in this process. Most of the time, the AI will make mistakes, and you’ll need to ask it to fix them. You can’t expect it to get everything right the first time—either your prompt might not be clear, or the AI could make an error.

People might criticize using AI to generate blog articles, but no one complains if you use AI to generate code. So, take advantage of that!

Share

Twitter
Facebook
LinkedIn
Reddit
Pinterest

Related Posts

Toufique Alahi

Hi there! I enjoy writing about WordPress and sharing my hands-on experiences. I explore new features, tips, and tweaks. Stick around for helpful tutorials and insights!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.