wp_tinymce_inline_scripts()
- Since
- 5.0.0
- Source
wp-includes/script-loader.php:525
Description
These TinyMCE init settings are used to extend and override the default settings from _WP_Editors::default_settings() for the Classic block.
Compatibility
- WordPress
- since 5.0.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Performance profile
How much work a call to wp_tinymce_inline_scripts() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Light
- Scaling
- Scales with input
- Instructions
- 110–124
- Plugin surface
- 9 hooks
- Called by
- 0
Touches nothing outside its own arguments.
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 170.
Third-party callbacks on 'wp_editor_settings', 'tiny_mce_plugins', 'disable_captions' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters()called directly
Further down the call graph this can also reach option, cache, serialize, query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 2 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_tinymce_inline_scripts() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 110–118 | apply_filters(), apply_filters(), array_unique(), apply_filters(), apply_filters(), apply_filters(), apply_filters(), apply_filters(), apply_filters(), wp_json_encode(), apply_filters(), includes_url(), wp_json_encode(), ->add_inline_script() |
!empty($editor_settings) | 119–124 | apply_filters(), apply_filters(), array_unique(), apply_filters(), apply_filters(), apply_filters(), apply_filters(), apply_filters(), apply_filters(), wp_json_encode(), array_merge(), apply_filters(), includes_url(), wp_json_encode(), ->add_inline_script() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 170 | 110–124 | 16 | |
| 8.5 | 170 | 110–124 | 16 | |
| 8.4 | 170 | 110–124 | 16 | 21 fewer instructions than PHP 8.3 |
| 8.3 | 191 | 128–142 | 16 | |
| 8.2 | 191 | 128–142 | 16 | |
| 8.1 | 191 | 128–142 | 16 | |
| 7.4 | 191 | 128–142 | 16 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 9
9 hooks fire while wp_tinymce_inline_scripts() runs, in this order:
- apply_filters( wp_editor_settings )filterline 529 (+4 into the body)
Filters the wp_editor() settings.
- apply_filters( tiny_mce_plugins )filterline 553 (+28 into the body)
Filters the list of default TinyMCE plugins.
- apply_filters( disable_captions )filterline 559 (+34 into the body)
Filters whether to disable captions.
- apply_filters( mce_buttons )filterline 582 (+57 into the body)
Filters the first-row list of TinyMCE buttons (Visual tab).
- apply_filters( mce_buttons_2 )filterline 599 (+74 into the body)
Filters the second-row list of TinyMCE buttons (Visual tab).
- apply_filters( mce_buttons_3 )filterline 601 (+76 into the body)
Filters the third-row list of TinyMCE buttons (Visual tab).
- apply_filters( mce_buttons_4 )filterline 603 (+78 into the body)
Filters the fourth-row list of TinyMCE buttons (Visual tab).
- apply_filters( mce_external_plugins )filterline 605 (+80 into the body)
Filters the list of TinyMCE external plugins.
- apply_filters( tiny_mce_before_init )filterline 626 (+101 into the body)
Filters the TinyMCE config before init.
Uses · 3
- apply_filters()Calls the callback functions that have been added to a filter hook.
- wp_json_encode()Encodes a variable into JSON, with some confidence checks.
- includes_url()Retrieves the URL to the includes directory.
Source code
function wp_tinymce_inline_scripts() { global $wp_scripts; /** This filter is documented in wp-includes/class-wp-editor.php */ $editor_settings = apply_filters( 'wp_editor_settings', array( 'tinymce' => true ), 'classic-block' ); $tinymce_plugins = array( 'charmap', 'colorpicker', 'hr', 'lists', 'media', 'paste', 'tabfocus', 'textcolor', 'fullscreen', 'wordpress', 'wpautoresize', 'wpeditimage', 'wpemoji', 'wpgallery', 'wplink', 'wpdialogs', 'wptextpattern', 'wpview', ); /** This filter is documented in wp-includes/class-wp-editor.php */ $tinymce_plugins = apply_filters( 'tiny_mce_plugins', $tinymce_plugins, 'classic-block' ); $tinymce_plugins = array_unique( $tinymce_plugins ); $disable_captions = false; // Runs after `tiny_mce_plugins` but before `mce_buttons`. /** This filter is documented in wp-admin/includes/media.php */ if ( apply_filters( 'disable_captions', '' ) ) { $disable_captions = true; } $toolbar1 = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'wp_add_media', 'wp_adv', ); /** This filter is documented in wp-includes/class-wp-editor.php */ $toolbar1 = apply_filters( 'mce_buttons', $toolbar1, 'classic-block' ); $toolbar2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help', ); /** This filter is documented in wp-includes/class-wp-editor.php */ $toolbar2 = apply_filters( 'mce_buttons_2', $toolbar2, 'classic-block' ); /** This filter is documented in wp-includes/class-wp-editor.php */ $toolbar3 = apply_filters( 'mce_buttons_3', array(), 'classic-block' ); /** This filter is documented in wp-includes/class-wp-editor.php */ $toolbar4 = apply_filters( 'mce_buttons_4', array(), 'classic-block' ); /** This filter is documented in wp-includes/class-wp-editor.php */Changelog
Introduced in 5.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/script-loader.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.