I want to learn how to write a WordPress plugin from scratch but don’t know where to begin. Any tips or good starting points would be appreciated!
You can start here: Introduction to Plugin Development – Plugin Handbook | Developer.WordPress.org
WordPress docs are super helpful. Also, check out some YouTube tutorials from reliable creators. They explain things well.
I used AI to help me write my first plugin a few months back, and it worked pretty well. But for my second one, I ended up getting better info from forums and StackOverflow.
Addison said:
I used AI to help me write my first plugin a few months back, and it worked pretty well. But for my second one, I ended up getting better info from forums and StackOverflow.
That’s interesting… what kind of plugin was it?
@Cai
It was a custom plugin for displaying schedules on a client’s website. I already knew basic PHP and SQL, but WordPress has specific functions to handle the database safely, and the AI helped me figure that out.
The plugin reads data from a database table and shows it on different parts of the site using shortcodes. I couldn’t find an existing plugin that did what I needed, so I made one myself.
Without the AI, it would have taken way too long, and my client wouldn’t have been happy paying for all that extra time.
@Addison
That’s a pretty neat project.
Here’s a quick Google search link: how to write a wordpress plugin - Google Search
Whitney said:
Here’s a quick Google search link: how to write a wordpress plugin - Google Search
I prefer this site for that kind of response: https://letmegooglethat.com/
@Kip
Haha, I thought that site was gone! Didn’t they use to have lmgtfy.com?
Cai said:
@Kip
Haha, I thought that site was gone! Didn’t they use to have lmgtfy.com?
Yeah, that one still exists too: https://lmgtfy.app/
Cai said:
@Kip
Haha, I thought that site was gone! Didn’t they use to have lmgtfy.com?
Yeah, that one still exists too: https://lmgtfy.app/
Nice, good old memories.
@Kip
I just skipped the passive-aggressive part and went straight to Google.
The easiest way is to start with a boilerplate. Creating all the required files manually is boring. There are sites that generate those files for you.
Once you have that, start by adding simple functions in the main plugin file. YouTube has plenty of videos explaining how to do this.
Here’s a boilerplate with docs:
Or if you want something quicker:
@Haze
I used that boilerplate when I started making plugins around 2016. It’s still useful, though not perfect anymore. Tons of plugins are built using it. It’s a safe starting point if you’re still learning.
Start with a single file that does something simple, like adding a post type or enqueuing some CSS or JS. First, focus on learning how hooks and filters work in WordPress.
Once you understand that, the rest is just general coding. Don’t worry too much about complex designs early on. You can always improve things later.
Honestly, you could ask AI to write a basic plugin for you, then study and improve it. In my case, it gave me a solid starting point, and I worked from there.
Give it as much detail as you can in your prompt to get better results.