I use register_theme_directory()
in a mu-plugin to register a custom theme directory (located at project_root/app/views/
, with site_root at project_root/public/
and WordPress in a Git submodule at project_root/public/wp/
. WP_CONTENT_DIR
is at project_root/public/content
).
I also use Capistrano to deploy my project.
Every time I deploy, the site breaks, and I get this message in my Dashboard:
ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.
When I navigate into the Appearance tab, my theme doesn’t appear on the list until I refresh the page. After refreshing, I can see my theme, activate it, and everything works again.
Why might this be happening on every deploy? I am confused as to why WordPress would think the theme doesn’t exist, when it definitely does.
1 Answer
There is a bug in class-wp-upgrader.php
: WordPress is using the fixed path WP_CONTENT_DIR . '/themes'
and doesn’t use get_theme_root()
.
I have written a patch 7 months ago … which was too late for WordPress 3.6 – the fix was delayed just today.
So use my patch, or jump in on Trac and explain why this is important.