[wp-trac] [WordPress Trac] #24143: When define('WP_CONTENT_DIR', 'your-dir') twentythirteen - The theme directory does not exist.

WordPress Trac noreply at wordpress.org
Mon Feb 10 10:08:02 UTC 2014


#24143: When define('WP_CONTENT_DIR', 'your-dir') twentythirteen - The theme
directory does not exist.
--------------------------+------------------------------
 Reporter:  azizur        |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:  3.4
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by Denis-de-Bernardy):

 * keywords:  reporter-feedback =>


Comment:

 Replying to [comment:14 nacin]:
 > I don't think the solution for this is forcibly registering wp-
 content/themes. I think a better solution might be to, on themes.php,
 notice there are no themes and deduce why. Thoughts?

 Yeah, I suppose. Here's what I ended up doing in a mu-plugin, fwiw:

 {{{
     /**
      * Conditionally registers the default wp-cotent/themes folder
      **/
     public function maybeRegisterDefaultThemeDir()
     {
         # Bail if no custom content folder is defined
         if (WP_CONTENT_DIR . '/themes' == ABSPATH . 'wp-content/themes')
 return;

         # Bail if a default theme is defined:
         # WP doesn't set it until later, so assume it's in WP_CONTENT_DIR
         if (defined('DEFAULT_THEME')) return;

         register_theme_directory(ABSPATH . 'wp-content/themes');
     }
 }}}

 The `DEFAULT_THEME` define gets set in an unwieldy location, and any
 number of plugins can trash whatever fix one might attempt on the
 `'setup_theme'` hook, so it seemed like a lesser evil.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/24143#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list