WP_Theme::network_enable_theme( string|array $stylesheets )

Enables a theme for all sites on the current network.


Description Description


Parameters Parameters

$stylesheets

(string|array) (Required) Stylesheet name or array of stylesheet names.


Top ↑

Source Source

File: wp-includes/class-wp-theme.php

	public static function network_enable_theme( $stylesheets ) {
		if ( ! is_multisite() ) {
			return;
		}

		if ( ! is_array( $stylesheets ) ) {
			$stylesheets = array( $stylesheets );
		}

		$allowed_themes = get_site_option( 'allowedthemes' );
		foreach ( $stylesheets as $stylesheet ) {
			$allowed_themes[ $stylesheet ] = true;
		}

		update_site_option( 'allowedthemes', $allowed_themes );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.