Create a Virtual File in WordPress with Support for WordPress Multisite

Recently I was working on a WordPress Multisite instance, and I needed each site (multilingual in this instance) to have their own unique dynamically generated sitemap. I generated these sitemaps by creating virtual files within WordPress. This article shows you how to create a virtual file, and then how to ensure that that virtual file…

Import your Existing Website into a WordPress Install via RSS

Do you want to import an existing website into WordPress? Does that existing site provide an RSS feed? Then this is the article for you. The great news is WordPress has a default importer for RSS. Simply go to Tools > Import via your WordPress dashboard. If you haven’t already you will need to install…

Converting React.createClass to React.Component

In my last article I talked about patching older versions of React to work in a modern environment. In this article I go one further and give a step by step guide to upgrading a classic React component to a modern one, by switching out the React.createClass way of doing things to the modern and…

Broken React.createClass Component? Let’s Fix It!

If you are building WordPress Gutenberg Blocks (or even if you are not) you may be trying to get a third party React Component working in your build. But if it’s an older element, specifically one that uses the deprecated React.createClass method, you may get stuck. The files that accompany this tutorial are in the…

Working with Gutenberg and the WordPress REST API

In this article I take the Select2 component that I previously added to my Gutenberg plugin, and make it dynamic by taking advantage of the WordPress REST API. This code borrows heavily from the Secure Blocks for Gutenberg plugin. In this example we will be making the ‘Select Roles’ Inspector use dynamic data from the…

Add Select2 as an InspectorControl in WordPress Gutenberg

For a project I was working on I wanted to use Select2 as a Gutenberg InpectorControl to allow me apply settings to a block. This tutorial will also give you the foundation you need for getting any third party React Component into the WordPress Gutenberg Editor. Select2 is a super handy replacement for select boxes on…

Custom TinyMCE Editor Formatting in WordPress

Sometimes when writing a block of text using the WordPress editor, you need it to look a certain way, we usually do this by adding styles to pieces of text, but we don’t always want our clients to have to open up the text editor and do this manually. In this example we will create…

Changing your WordPress site language (locale) dynamically

There are some fantastic multilingual plugins for WordPress, however for one client project I needed something far more flexible, as this particular client needed to cater for several countries that each spoke several languages. In short the client needed to be able to have a multisite instance that had a country and language set as…

Enforce Version Control in WordPress to Boost Security

If you have spent a long time working on your clients website, ensuring everything is in version control (such as git). Then you would be pretty gutted if your client edits a theme file, or adds a new plugin that lives outside of your version controlled workflow. Adding code that lives outside of a tightly controlled workflow means:…

Stop Clickjacking by preventing your WordPress site loading in a Frame

Clickjacking is a potential security risk caused by someone loading your website inside a frame on another website and making it appear as if the website is legitimate, however they will be hijacking interactions you make with that site, such as form submissions. I wrote about how to manage this over on my Wholesome Code…