Theme Blockaide is a lightweight developer utility designed to bridge the gap between WordPress Full Site Editing (FSE) and traditional file-based Git deployment workflows. By automatically detecting your environment, it acts as a digital assistant that freezes the Site Editor UI on staging and production — preventing accidental database template overrides and keeping your source-controlled theme files as the single source of truth.
The conflict between FSE and file-based deployment workflows is a known architectural tension in WordPress development, documented in Gutenberg discussion #59480. When a user saves changes in the Site Editor, WordPress writes templates to the database, which silently takes precedence over theme files — breaking Git-based deployment pipelines. Theme Blockaide cuts the Gordian knot by treating FSE as a local-only build tool rather than attempting to sync database state with version-controlled files.
WordPress FSE writes templates and template parts to the database when saved via the Site Editor. DB-stored records silently take precedence over theme files, which breaks file-based deployment pipelines (rsync, GitHub Actions, etc.). Theme Blockaide solves this by removing all Site Editor entry points on any environment other than local, leaving FSE fully functional for development while locking it down everywhere else.
On non-local environments, seven lockout vectors are applied:
- Admin menu — removes Appearance > Editor
- Admin toolbar — removes the Edit Site node on the frontend toolbar
- Direct URL access — redirects
/wp-admin/site-editor.phpto/wp-admin/ - Block editor template mode — suppresses the Template tab in the post/page editor sidebar
- Template path resolution — intercepts
.htmlFSE template lookup so DB-stored templates cannot be served even if the above UI entry points are somehow bypassed - Command Palette — deregisters the
core/edit-sitecommand from the WP 7.0+ Command Palette (cmd+k / ctrl+k), which bypasses PHP hooks entirely - Customize button — removes the non-functional Customize button from the Themes admin screen
On local, the plugin does nothing. FSE works normally.
- WordPress 5.9 or later (FSE / block theme support)
- PHP 8.0 or later (
str_ends_with()is used internally) WP_ENVIRONMENT_TYPEdefined inwp-config.phpon each target environment
Must-use plugins are not managed via the WordPress Plugins screen and cannot be installed through it. They must be placed on the server manually or via a deployment pipeline.
WordPress only auto-loads PHP files placed directly in mu-plugins/ — it does not recurse into subdirectories. Because this plugin lives in a subdirectory (mu-plugins/wp-theme-blockaide/), a small loader file must also be present one level up in mu-plugins/ to require it.
Create wp-content/mu-plugins/load-theme-blockaide.php with the following contents:
<?php
/**
* Plugin Name: Theme Blockaide Loader
* Description: Safely loads Theme Blockaide plugin's environment-locking utility to protect file-based workflows.
*/
// Load Theme Blockaide from its clean subfolder
$_blockaide_file = WPMU_PLUGIN_DIR . '/wp-theme-blockaide/wp-theme-blockaide.php';
if ( file_exists( $_blockaide_file ) ) {
require_once $_blockaide_file;
}
unset( $_blockaide_file );This file is intentionally kept outside the versioned repo — it is a one-time server setup step, not something that gets deployed with each release. Without it, the plugin will be present on disk but will never load.
- Copy the
wp-theme-blockaidefolder intowp-content/mu-plugins/:wp-content/ └── mu-plugins/ ├── load-theme-blockaide.php ← create this manually (see above) └── wp-theme-blockaide/ ├── wp-theme-blockaide.php └── lock-fse-non-local.php - Create
load-theme-blockaide.phpas shown above if it does not already exist. - No activation step required — WordPress loads must-use plugins automatically on the next request.
If you have WP-CLI access and the repo checked out locally:
cp -r wp-theme-blockaide /path/to/wordpress/wp-content/mu-plugins/Then create the loader file if it does not exist:
cat > /path/to/wordpress/wp-content/mu-plugins/load-theme-blockaide.php << 'EOF'
<?php
/**
* Plugin Name: Theme Blockaide Loader
* Description: Safely loads Theme Blockaide plugin's environment-locking utility to protect file-based workflows.
*/
// Load Theme Blockaide from its clean subfolder
$_blockaide_file = WPMU_PLUGIN_DIR . '/wp-theme-blockaide/wp-theme-blockaide.php';
if ( file_exists( $_blockaide_file ) ) {
require_once $_blockaide_file;
}
unset( $_blockaide_file );
EOFNo settings page. Behaviour is controlled entirely by WP_ENVIRONMENT_TYPE in wp-config.php.
// Local — FSE fully available, plugin does nothing
define( 'WP_ENVIRONMENT_TYPE', 'local' );
// Staging — all lockout vectors active
define( 'WP_ENVIRONMENT_TYPE', 'staging' );
// Production — all lockout vectors active
define( 'WP_ENVIRONMENT_TYPE', 'production' );If WP_ENVIRONMENT_TYPE is not defined, wp_get_environment_type() returns 'production' by default, so the lockout will be active.
After deploying to a non-local environment, confirm the following:
- Admin menu — Appearance > Editor does not appear in the sidebar
- Direct URL — navigating to
/wp-admin/site-editor.phpredirects to/wp-admin/ - Admin toolbar — Edit Site is absent from the frontend toolbar when logged in as admin
- Block editor — no Template tab in the Document panel when editing a post or page
- Command Palette — opening cmd+k / ctrl+k in the block editor shows no Site Editor or Edit Site commands
- Themes page — no Customize button appears for the active theme on
/wp-admin/themes.php - Frontend rendering — the theme still loads and renders correctly (templates are served from theme files as expected)
= 1.0.1 =
- Moved admin_bar_menu hook outside is_admin() guard so the Edit Site node is removed from the admin bar on frontend views, not only in the admin
= 1.0.0 =
- Initial release