WordPress.org

Codex

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

Function Reference/switch theme

Description

Switches current theme to new template and stylesheet names.
Accepts one argument: $stylesheet of the theme. ($stylesheet is the name of your folder slug. It's the same value that you'd use for a child theme, something like `twentythirteen`.) It also accepts an additional function signature of two arguments: $template then $stylesheet. This is for backwards compatibility.

Usage

<?php switch_theme$stylesheet ?> Optional usage for backwards compatibility: <?php switch_theme$template$stylesheet ?>

Parameters

Current Parameters

$stylesheet
(string) (required) Stylesheet name.
Default: None

Alternate Function Signature Parameters for Backwards Compatibility

$template
(string) (required) Template name.
Default: None
$stylesheet
(string) (required) Stylesheet name.
Default: None

Return Values

(void) 
This function does not return a value.

Examples

Notes

  • Uses: do_action() Calls 'switch_theme' action on updated theme display name.

Change Log

Since: 2.5.0
Altered 4/23 to define default/alternate function signature and parameters

Source File

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

Related

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