WP_Theme::network_enable_theme() public WP 4.6.0
Enables a theme for all sites on the current network.
{} Это метод класса: WP_Theme{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$result = WP_Theme::network_enable_theme( $stylesheets );
- $stylesheets(строка/строка[]) (обязательный)
- Stylesheet name or array of stylesheet names.
Список изменений
С версии 4.6.0 | Введена. |
Код WP_Theme::network_enable_theme() WP Theme::network enable theme WP 5.6.2
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 );
}