wp_tinymce_inline_scripts()
- Since
- 5.0.0
- Source
wp-includes/script-loader.php:518
Description
These TinyMCE init settings are used to extend and override the default settings from _WP_Editors::default_settings() for the Classic block.
Cost profile
Measured from the compiled opcodes, not from a stopwatch. Every number here is identical on any machine that runs the same PHP version, and every function in core is ranked by these figures.
- 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.4, 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.4.
| 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 |
|---|---|---|---|---|
7.4 | 191 | 128–142 | 16 | More instructions than PHP 8.4 |
8.1 | 191 | 128–142 | 16 | More instructions than PHP 8.4 |
8.2 | 191 | 128–142 | 16 | More instructions than PHP 8.4 |
8.3 | 191 | 128–142 | 16 | More instructions than PHP 8.4 |
8.4 | 170 | 110–124 | 16 | Compiles to the same instructions |
Oldest PHP that compiles this body: 7.4. An instruction is not a fixed amount of time, so a version with the same count is not necessarily the same speed; what the count rules out is a difference in the work itself.
Hooks fired · 9
9 hooks fire while wp_tinymce_inline_scripts() runs, in this order:
- apply_filters( wp_editor_settings )filterline 522 (+4 into the body)
Filters the wp_editor() settings.
- apply_filters( tiny_mce_plugins )filterline 546 (+28 into the body)
Filters the list of default TinyMCE plugins.
- apply_filters( disable_captions )filterline 552 (+34 into the body)
Filters whether to disable captions.
- apply_filters( mce_buttons )filterline 575 (+57 into the body)
Filters the first-row list of TinyMCE buttons (Visual tab).
- apply_filters( mce_buttons_2 )filterline 592 (+74 into the body)
Filters the second-row list of TinyMCE buttons (Visual tab).
- apply_filters( mce_buttons_3 )filterline 594 (+76 into the body)
Filters the third-row list of TinyMCE buttons (Visual tab).
- apply_filters( mce_buttons_4 )filterline 596 (+78 into the body)
Filters the fourth-row list of TinyMCE buttons (Visual tab).
- apply_filters( mce_external_plugins )filterline 598 (+80 into the body)
Filters the list of TinyMCE external plugins.
- apply_filters( tiny_mce_before_init )filterline 619 (+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
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 */History
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 6.9.7 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.