WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/register theme directory

Description

Register a directory that contains themes.

Usage

<?php register_theme_directory$directory ?>

Parameters

$directory
(string) (required) Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR. Do not include a trailing slash.
Default: None

Return Values

(boolean) 
False for failure. True for success.

Examples

Register a plugin's subdirectory as a theme folder

<?php

/*
 * For directory structure like:
 * 
 * /my-plugin/
 * - /my-plugin.php
 * - /themes/
 *
 * You would put this in my-plugin.php.
 */
register_theme_directory( dirname( __FILE__ ) . '/themes' );

Notes

  • Uses global: (unknown type) $wp_theme_directories

Change Log

Since: 2.9.0

Source File

register_theme_directory() is located in wp-includes/theme.php.

Related

See also index of Function Reference and index of Template Tags.