WP_Theme::network_disable_theme()public staticWP 4.6.0

Disables a theme for all sites on the current network.

Метод класса: WP_Theme{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WP_Theme::network_disable_theme( $stylesheets );
$stylesheets(строка|string[]) (обязательный)
Stylesheet name or array of stylesheet names.

Список изменений

С версии 4.6.0 Введена.

Код WP_Theme::network_disable_theme() WP 6.5.2

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

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

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

	update_site_option( 'allowedthemes', $allowed_themes );
}