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 … Continue reading Do I Need to Learn React to Build Gutenberg Blocks?

Surfacing Gutenberg Blocks in the WordPress REST API

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 … Continue reading Surfacing Gutenberg Blocks in the WordPress REST API

WordPress and the Open-Closed Principle

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 … Continue reading WordPress and the Open-Closed Principle

Creating 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 … Continue reading Creating a Better WordPress Loop

Making WordPress REST API Calls Internally

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 … Continue reading Making WordPress REST API Calls Internally

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 … Continue reading Async or Defer JavaScript Files in WordPress

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, … Continue reading WordPress Post Expiration Module

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 … Continue reading Redirect Entire Website Except WordPress Admin