How to change the theme directory on a WordPress installation

The beauty in WordPress is not only its ecosystem. It’s the ability to customise almost every facet of it using a filter or hook.

I had a scenario recently where I wanted to put a web application theme in a less painful directory to access. I wanted a folder called themes in my root directory.

Instead of wp-content/themes/my-app-theme I wanted themes/my-app-theme instead.

The structure resembles something like this:

themes
my-app-theme
wp-content
wp-includes
index.php
wp-config.php

We can tell WordPress about a new place to look for themes. It’s not a filter or hook, it’s a function called register_theme_directory.

To configure the theme’s location, we must make the change outside of our theme. We will create a simple plugin that will go into wp-content/mu-plugins which get automatically loaded without requiring activation. I called mine modify-theme-path.php call yours whatever you want.

Now, WordPress will look in my root directory for a themes folder but will also continue to look in wp-content/themes as well.