wppaste
WordPress

do_block_editor_incompatible_meta_box( mixed $data_object, array $box )

Since
5.0.0
Source
wp-admin/includes/template.php:1190
Renders a "fake" meta box with an information message, shown on the block editor, when an incompatible meta box is found.

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.
  • $idstring

    Meta box 'id' attribute.
  • $titlestring

    Meta box title.
  • $old_callbackcallable

    The original callback for this meta box.
  • $argsarray

    Extra 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

Reaches the database via get_post().

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
24–57

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 111.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • cacheobject cachewp_cache_get()one call below do_block_editor_incompatible_meta_box()
  • hookthird-party callbacksapply_filters()one call below do_block_editor_incompatible_meta_box()
  • querycontent queryget_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.

WhenInstructionsCalls 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 instanceof46_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 instanceof55_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

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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 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-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.