Plugins have been part of the WordPress system since version 1.2 in 2004. The “core” of WordPress has always been constrained to a basic set of functionality necessary for its operation and the concept has always been that users and developers who need additional functionality add it themselves. The public-access plugin directory has grown over the past eighteen years and now offers nearly 60,000 plugins which extend WordPress in varying ways: all of them for free under an open-source license.
The recent release of WordPress 5.9 introduces content creators, site managers and developers to Full Site Editing, with which it’s possible to edit the entire layout of every view – post, page, list, header and footer – without writing any code at all. This new focus on Themes – the base of a website which defines how the website looks – is a good time to remember one of the main tenets of WordPress development.
Themes are for appearance, plugins are for functionality.
If a site has functionality which is essential to keep the existing content from disappearing – for example the registration of a custom post type or the addition of custom content blocks – then this functionality should be added through a plugin, not through the theme. This will allow the site owner or maintainer to start using a new theme without losing essential functionality. If a theme provides custom blocks, and these are used in the content, then the chances are high that these pieces of content won’t work properly (if at all) if you change the theme.
I’ve continually developed and extended the current theme “Picard” 1 on my own site since the beginning of 2019, when I began building sites using the block editor in earnest. Because of time constrictions and a steep learning curve for a new development process, I’ve been lazy and added custom blocks through the theme code. Now that I want to switch the site to a full-site-editing theme, I’m having to migrate all of the functionality and blocks out of the theme to a “must-use” plugin: one which cannot be deactivated and which contains absolutely everything the site needs, irrespective of the theme being used.
I called my WordPress Theme “Picard” because when I began work on it, I was re-watching the entire set of Star Trek: The Next Generation.