Files
wp-nuxt-devenv-starter/plugins/theme-directory.php
2026-07-19 22:09:52 +02:00

24 lines
598 B
PHP

<?php
/**
* Plugin Name: Theme Directory
* Description: Registers the repo-root themes/ directory as an additional theme root.
*/
$repo_theme_root = dirname( ABSPATH ) . '/themes';
register_theme_directory( $repo_theme_root );
add_filter(
'theme_root_uri',
function ( $theme_root_uri, $siteurl ) use ( $repo_theme_root ) {
// Core falls back to the raw filesystem path for registered roots it
// cannot map to a URL; rewrite that to where nginx serves themes/.
if ( $theme_root_uri === $repo_theme_root ) {
return $siteurl . '/themes';
}
return $theme_root_uri;
},
10,
2
);