_WP_Editors::force_uncompressed_tinymce()public staticWP 5.0.0

Force uncompressed TinyMCE when a custom theme has been defined.

The compressed TinyMCE file cannot deal with custom themes, so this makes sure that WordPress uses the uncompressed TinyMCE file if a theme is defined. Even if the website is running on a production environment.

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

Хуков нет.

Возвращает

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

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

$result = _WP_Editors::force_uncompressed_tinymce();

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

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

Код _WP_Editors::force_uncompressed_tinymce() WP 6.4.3

public static function force_uncompressed_tinymce() {
	$has_custom_theme = false;
	foreach ( self::$mce_settings as $init ) {
		if ( ! empty( $init['theme_url'] ) ) {
			$has_custom_theme = true;
			break;
		}
	}

	if ( ! $has_custom_theme ) {
		return;
	}

	$wp_scripts = wp_scripts();

	$wp_scripts->remove( 'wp-tinymce' );
	wp_register_tinymce_scripts( $wp_scripts, true );
}