Filter hook 'tiny_mce_before_init'

in WP Core File wp-includes/script-loader.php at line 617

View Source

tiny_mce_before_init

Filter Hook
Description
Adds inline scripts required for the TinyMCE in the block editor. These TinyMCE init settings are used to extend and override the default settings from `_WP_Editors::default_settings()` for the Classic block.

Hook Information

File Location wp-includes/script-loader.php View on GitHub
Hook Type Filter
Line Number 617

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into tiny_mce_before_init
add_filter('tiny_mce_before_init', 'my_custom_filter');

function my_custom_filter() {
    // Your custom filtering logic here
    return 'modified_value';
}

Source Code Context

wp-includes/script-loader.php:617 - How this hook is used in WordPress core
<?php
 612  	if ( ! empty( $editor_settings['tinymce'] ) && is_array( $editor_settings['tinymce'] ) ) {
 613  		$tinymce_settings = array_merge( $tinymce_settings, $editor_settings['tinymce'] );
 614  	}
 615  
 616  	/** This filter is documented in wp-includes/class-wp-editor.php */
 617  	$tinymce_settings = apply_filters( 'tiny_mce_before_init', $tinymce_settings, 'classic-block' );
 618  
 619  	/*
 620  	 * Do "by hand" translation from PHP array to js object.
 621  	 * Prevents breakage in some custom settings.
 622  	 */

PHP Documentation

<?php
/**
 * Adds inline scripts required for the TinyMCE in the block editor.
 *
 * These TinyMCE init settings are used to extend and override the default settings
 * from `_WP_Editors::default_settings()` for the Classic block.
 *
 * @since 5.0.0
 *
 * @global WP_Scripts $wp_scripts
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 0
  • File: wp-includes/script-loader.php
Related Hooks

Related hooks will be displayed here in future updates.