Do I Need to Learn React to Build Gutenberg Blocks?

The question of the day is: Do I need to learn React in order to build a Gutenberg block? The short answer is no. You don’t need to know anything about React to build a Gutenberg block. The reason why is because WordPress has done a great job of abstracting away React and the foundational…… Read More

Surfacing Gutenberg Blocks in the WordPress REST API

Gutenberg

The beauty of Gutenberg is that the HTML content is more structured and semantic while also simplifying the user experience. All of the data is stored in the post content, which is also great because we don’t have to request a bunch of post meta to render the page. On the other hand, if nothing…… Read More

WordPress and the Open-Closed Principle

Rusty Open Sign

Oftentimes we think of the SOLID principles of object-oriented┬áprogramming as just that: object-oriented programming principles. However, we are going to take a closer look at the second principle, the open-closed principle, and see how it applies to WordPress. You are probably thinking, “WordPress isn’t really object-oriented”… and you’d be mostly right. Much of WordPress is…… Read More

Advice for New Programmers

Learning to Code

I’ve been a programmer for just over a decade now and have always shared and taught others as I’ve learned. However, much of that information has never really been documented except in the form of videos from talks at conferences. I want to take some time to offer a few tips to those who are…… Read More

Creating a Better WordPress Loop

A Better WordPress Loop

The WordPress loop is ubiquitous. It is one of the first things you learn as a WordPress developer and it is something you must know the intricacies of in order to avoid causing problems. I’ve dreamt of a day when the WordPress loop and all its various implementations are no longer necessary. Today, I would…… Read More

Making WordPress REST API Calls Internally

WordPress REST API

The WordPress REST API is great for gaining access to your data from external sites or from front-end JavaScript applications. It is even great for one-off calls you probably used to make via normal WordPress AJAX. However, have you ever wanted or needed to make WordPress REST API calls internally? What do I mean? I…… Read More

Async or Defer JavaScript Files in WordPress

There are a lot of articles out there about how to async or defer scripts in WordPress, but they assume you’ll be writing all the code or using one of the bloated plugins to make it happen. In my case, I just needed the ability to async or defer a few scripts in a custom…… Read More

WordPress Post Expiration Module

WordPress plugins are great, but sometimes you want to avoid having additional settings screens or giving a client access to make changes that could break functionality on their website. If you aren’t a coder and you want to automatically expire a post in WordPress, I’d recommend that you check out the Post Expirator plugin. However,…… Read More

Redirect Entire Website Except WordPress Admin

I get asked a lot about how to handle different types of website redirects. Usually, someone wants to redirect an entire site, or maybe just redirect a subdomain.  Other times, they want to do simple one-off redirects. Many web servers that run WordPress use Apache, which means that .htaccess rules will work. Other web servers like…… Read More

Add Helper Classes to WordPress Navigation Menus

WordPress automatically outputs a lot of helpful CSS class names for menus. If you use the wp_nav_menu() function to display your menus, as all good themes should do, you don’t have to settle for just the default class names.