I’m excited to announce that I self-published an eBook about refactoring WordPress plugins and launched new membership plans. This launch is part of my pivot for Plugin Machine. For now, I will focus on writing open-source plugins and other tools. I will be writing more eBooks about that code. For example, part 2 of this book will be based on adding a UI to the membership plugin I wrote last week to power this.
The book is on sale now — thank you to everyone from my email list who purchased it already.
Refactoring WordPress Plugins Part 1
I have written about most of the topics that this book covered in the past. Those posts are old now, they are from like 2015 or so. I don’t agree with everything past Josh taught. Since then PHP has gotten better, I’ve worked at a WordPress plugin company and an agency. I’ve also learned Laravel and built WordPress products that use WordPress and Laravel together.
So I wanted to do an update and wrote new versions earlier this year. This is all side project work for me and I did a lot of extra WordPress development around it. So it took a while, but I have an example code for this book that’s based on real code. Also, because Josh, the membership plugin I started for this is going to be part of the example code for part 2.
This book is for experienced WordPress developers who want to improve their plugins, use new modern best practices and adopt test-driven development.
- How to remove singletons
- Code examples based on plugins I’m working on now. Often with links to pull requests.
- How to write tests with phpunit for WordPress plugins
- How to make your plugin easier to extend by third-party developers
This is part 1, which focuses on PHP: writing tests, and refactoring singletons. Part 2 will cover converting shortcodes to blocks and admin-ajax to Rest API or GraphQL.
Short And To The Point
I don’t know about you, but most of the time I’ve gotten hired to write code for a WordPress plugin, it’s fixing a bug or adding new features, not writing a new plugin. That kind of work is hard because you generally need to do a lot of refactoring first, just to make it practical. That’s what this book is based on.
Most of the educational content I have written was based on what I was working on, something I learned, or an interesting question another developer asked. As I work on new content, and expand this site, members will be able to shape what they learn here.
In addition to getting access to all published eBooks as downloads, members will be able to log in to the site. When logged in, members can read content on the site and leave comments.
Request New Code Samples
If you join the site and are reading the new eBook — in the downloaded PDF or on the site — and find I’m talking about something similar to a challenge you are facing, let me know. If you have a question about how to apply the content to what you are working on or would like to see a code sample relevant to what you are working on, you can leave a comment.
Early Access To Content
Members will also get early access to future blog posts, and eBooks. This will include chapters of future eBooks that are currently incomplete.
Members may also be invited to early beta test plugins and open-source tools.
Built With WordPress
I wrote most of the book in the block editor. In the past, I have used Google docs for most of my writing. That’s a lot easier, but I always get annoyed because the code looks terrible in it. I probably could have published this in February if I wasn’t messing with WordPress so much, but I am pretty happy with the writing experience now that I got everything set up the way I wanted it.
I am using the plugin Print My Blog to generate the PDFs and ePubs of the eBook. It’s a simple-to-use plugin that has a Pro Print Service option that lets you lay out eBook content and generates nice PDFs using a remote service of some sort. It works well and is integrated into WordPress.
I am using Lemon Squeezy to sell this eBook. This is my first time using Lemons and they are very new. I like to support new independent products like this. I am impressed with their dashboard and the checkout flow is clean. They are still adding features, but I am excited to see where they go.
The membership features are using a plugin I wrote last week that I will open source soon. It’s going to be the least feature-complete membership plugin, at least for now.
Learn, Refactor, Repeat
I am excited to focus on writing open-source plugins and tools while creating educational content based on my experience. Refactoring WordPress Plugins Part 1 is just the beginning, and I look forward to writing more eBooks and creating new educational content for members.
If you’re an experienced WordPress developer looking to improve your plugins, adopt modern best practices, and learn test-driven development, then Refactoring WordPress Plugins Part 1 is for you. I look forward to continuing to provide valuable educational content and building a community of WordPress developers who are passionate about writing high-quality, maintainable code.