How to Bundle Theme(s) in a Plugin


If you build a plugin that require template modification, it might be a good idea to bundle an example theme in your plugin. And here’s how to do it.

It’s very simple. WordPress have a function to register a themes directory register_theme_directory( $path );.

It’s as simple as that. So here’s the full plugin example:

 * Plugin Name: f(x) Themes in Plugin Example
 * Plugin URI: 
 * Description: Simple example to bundle theme(s) in a plugin.
 * Version: 1.0.0
 * Author: David Chandra Purnama
 * Author URI:

 * Register Themes Directory
 * @link
register_theme_directory( trailingslashit( plugin_dir_path( __FILE__ ) ) . 'themes' );

And then you simply need to create “themes” directory in that plugin and add your bundled themes there.

To make it easier, here’s the full plugin:

This example plugins include 3 blank themes, so you’ll see this in Themes page:



If you using Windows Server (Local such as XAMPP included), It will not work because there’s seem to be a bug related to Themes PATH/URI in Windows server. But this will work fine in most host.

I’ll report this bug soon-ish after some test.


Leave a Reply

Your email address will not be published. Required fields are marked *