do_block_editor_incompatible_meta_box( mixed $data_object, array $box )
- Since
- 5.0.0
- Source
wp-admin/includes/template.php:1188
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.
Parameters
$data_objectmixed- The data object being rendered on this screen.
$boxarray- Custom formats meta box arguments.
$idstringMeta box 'id' attribute.$titlestringMeta box title.$old_callbackcallableThe original callback for this meta box.$argsarrayExtra meta box arguments.
Performance profile
How much work a call to do_block_editor_incompatible_meta_box() 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
- Heavy
- Scaling
- Constant
- Instructions
- 24–57
- Plugin surface
- None
- Called by
- 0
Reaches the database via get_post().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 111.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- cacheobject cache
wp_cache_get()one call below do_block_editor_incompatible_meta_box() - hookthird-party callbacks
apply_filters()one call below do_block_editor_incompatible_meta_box() - querycontent query
get_post()one call below do_block_editor_incompatible_meta_box()
Further down the call graph this can also reach option, serialize 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 · 12 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost do_block_editor_incompatible_meta_box() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
empty($plugins) && !current_user_can() | 24 | _get_plugin_from_callback(), get_plugins(), _e(), current_user_can() |
!empty($plugins) && !is_plugin_inactive() && !($data_object instanceof) | 26 | _get_plugin_from_callback(), get_plugins(), _e(), is_plugin_inactive() |
!empty($plugins) && is_plugin_inactive() && !current_user_can() | 28 | _get_plugin_from_callback(), get_plugins(), _e(), is_plugin_inactive(), current_user_can() |
empty($plugins) && !current_user_can() | 33 | _get_plugin_from_callback(), get_plugins(), __(), printf(), current_user_can() |
!empty($plugins) && !is_plugin_inactive() && !($data_object instanceof) | 35 | _get_plugin_from_callback(), get_plugins(), __(), printf(), is_plugin_inactive() |
!empty($plugins) && is_plugin_inactive() && !current_user_can() | 37 | _get_plugin_from_callback(), get_plugins(), __(), printf(), is_plugin_inactive(), current_user_can() |
!empty($plugins) && !is_plugin_inactive() && $data_object instanceof | 46 | _get_plugin_from_callback(), get_plugins(), _e(), is_plugin_inactive(), get_edit_post_link(), add_query_arg(), __(), esc_url(), printf() |
empty($plugins) && current_user_can() | 47 | _get_plugin_from_callback(), get_plugins(), _e(), current_user_can(), self_admin_url(), get_current_user_id(), wp_nonce_url(), __(), esc_url(), printf() |
!empty($plugins) && is_plugin_inactive() && current_user_can() | 48 | _get_plugin_from_callback(), get_plugins(), _e(), is_plugin_inactive(), current_user_can(), self_admin_url(), wp_nonce_url(), __(), esc_url(), printf() |
!empty($plugins) && !is_plugin_inactive() && $data_object instanceof | 55 | _get_plugin_from_callback(), get_plugins(), __(), printf(), is_plugin_inactive(), get_edit_post_link(), add_query_arg(), __(), esc_url(), printf() |
empty($plugins) && current_user_can() | 56 | _get_plugin_from_callback(), get_plugins(), __(), printf(), current_user_can(), self_admin_url(), get_current_user_id(), wp_nonce_url(), __(), esc_url(), printf() |
!empty($plugins) && is_plugin_inactive() && current_user_can() | 57 | _get_plugin_from_callback(), get_plugins(), __(), printf(), is_plugin_inactive(), current_user_can(), self_admin_url(), wp_nonce_url(), __(), esc_url(), printf() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 111 instructions, 24–57 executed per call, 6 branches. The work does not change between versions.
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.
Uses · 12
- _get_plugin_from_callback()Internal helper function to find the plugin from a meta box callback.
- get_plugins()Checks the plugins directory and retrieve all plugin files with plugin data.
- __()Retrieves the translation of $text.
- _e()Displays translated text.
- current_user_can()Returns whether the current user has the specified capability.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- self_admin_url()Retrieves the URL to the admin area for either the current site or the network depending on context.
- get_current_user_id()Gets the current user's ID.
- esc_url()Checks and cleans a URL.
- is_plugin_inactive()Determines whether the plugin is inactive.
- add_query_arg()Retrieves a modified URL query string.
- get_edit_post_link()Retrieves the edit post link for post.
Source code
function do_block_editor_incompatible_meta_box( $data_object, $box ) { $plugin = _get_plugin_from_callback( $box['old_callback'] ); $plugins = get_plugins(); echo '<p>'; if ( $plugin ) { /* translators: %s: The name of the plugin that generated this meta box. */ printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "<strong>{$plugin['Name']}</strong>" ); } else { _e( 'This meta box is not compatible with the block editor.' ); } echo '</p>'; if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) { if ( current_user_can( 'install_plugins' ) ) { $install_url = wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ); echo '<p>'; /* translators: %s: A link to install the Classic Editor plugin. */ printf( __( 'Please install the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $install_url ) ); echo '</p>'; } } elseif ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) { if ( current_user_can( 'activate_plugins' ) ) { $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php' ), 'activate-plugin_classic-editor/classic-editor.php' ); echo '<p>'; /* translators: %s: A link to activate the Classic Editor plugin. */ printf( __( 'Please activate the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $activate_url ) ); echo '</p>'; } } elseif ( $data_object instanceof WP_Post ) { $edit_url = add_query_arg( array( 'classic-editor' => '', 'classic-editor__forget' => '', ), get_edit_post_link( $data_object ) ); echo '<p>'; /* translators: %s: A link to use the Classic Editor plugin. */ printf( __( 'Please open the <a href="%s">classic editor</a> to use this meta box.' ), esc_url( $edit_url ) ); echo '</p>'; }}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.0.4 tag, from
src/wp-admin/includes/template.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.