Learn Code, From My Code

Members Get Access To Tutorials

Read my code, read why I wrote it this way, members can request code examples more relvant to problems they face.

I’m writing updated WordPress tutorials, and collecting the best resources for PHP and JavaScript development.

Less FooBar, More Actual Code

Read my WordPress plugins, learn how they work with first-party APIs — Laravel and NodeJS applications I develop — and third-party APIs.

Latest From The Blog

Creating Reusable React Hooks For The WordPress Block Editor or Whatever

The new React documentation site is live and looks great. This section on creating custom hooks to encapsulate logic that needs to be used in multiple places in a React application is quite good. This is an important strategy to learn, and can help a lot when developing multiple blocks for a WordPress site. In […]

How To Use WordPress Data Package To Get The Current Post Being Edited In The Post Editor

How to use the WordPress data module to get the current state of the post being editted in the WordPress block editor.

How To Insert Blocks In WordPress Block Editor

How to inserta block to the WordPress post editor, using JavaScript.

Using Plugin Machine To Build Zip Files of WordPress Plugins With Github Actions

Testing WordPress plugins, before they are released is super important. While I’m a big fan of automated testing, that doesn’t mean you don’t need manual testing. If your plugin uses modern tooling and has a PHP and/ or JavaScript build tooling, it’s not easy to get a development version of the plugin for testing. That’s […]

Members Only Tutorials

If you’re a member, you get access to completed and in progress tutorials. Leave comments and ask for code examples.

Learn Testing By Reading Tests: Two Factor

In this course, I’m going to be looking at tests in existing plugins and showing what they do well. This is based on the WordPress 2-factor authentication plugin, which has a small feature set. Many WordPress plugins need to run the same process with multiple providers. This plugin has one core feature, twp-factor authentication, which […]

Refactoring To Use A WordPress Plugin To Use A Container

WordPress plugins used to use one big class, that was a singleton, and exposed instances of all of the plugin’s classes. This worked, but singletons have a lot of downsides. It was the best solution in PHP 5.2, which we used to have to support. In the previous section, I wrote about singletons and their […]

Singletons & Dependnecy Injection In WordPress

In general a WordPress plugin will have one PHP class that is the main class of the plugin. Singletons used to be very common in WordPress plugins and have been a topic of debate in the community for awhile. I wrote a post in 2016 about Singletons in WordPress plugins, but my opinion has changed […]

Refactoring WordPress Plugins To Use Dependency Injection

The WordPress open source project is now 20 years old. In that time, PHP and JavaScript have changed a lot. There is still some old code from back then running and it works. That’s great, but if you’re writing PHP and JavaScript for WordPress now, we can do better.

Get Premium Membership

Plugin Machine is a free plugin generator based on how Josh makes plugins. Get access to plugin generator, WordPress tutorials, and Github repos to improve your code.