Renderiza las formas de las cajas meta.

Fuente

Expediente: wp-admin / includes / post.php

function the_block_editor_meta_boxes() 
	global $post, $current_screen, $wp_meta_boxes;

	// Handle meta box state.
	$_original_meta_boxes = $wp_meta_boxes;

	/**
	 * Fires right before the meta boxes are rendered.
	 *
	 * This allows for the filtering of meta box data, that should already be
	 * present by this point. Do not use as a means of adding meta box data.
	 *
	 * @since 5.0.0
	 *
	 * @param array $wp_meta_boxes Global meta box state.
	 */
	$wp_meta_boxes = apply_filters( 'filter_block_editor_meta_boxes', $wp_meta_boxes );
	$locations     = array( 'side', 'normal', 'advanced' );
	$priorities    = array( 'high', 'sorted', 'core', 'default', 'low' );

	// Render meta boxes.
	?>
	<formclass="metabox-base-form">the_block_editor_meta_box_post_form_hidden_fields($post);?>form><formid="toggle-custom-fields-form"method="post"action="echoesc_attr(admin_url('post.php'));?>">wp_nonce_field('toggle-custom-fields','toggle-custom-fields-nonce');?><inputtype="hidden"name="action"value="toggle-custom-fields"/>form>foreach($locationsas$location):?><formclass="metabox-location-echoesc_attr($location);?>"onsubmit="returnfalse;"><divid="poststuff"class="sidebar-open"><divid="postbox-container-2"class="postbox-container">do_meta_boxes($current_screen,$location,$post);?>div>div>form>endforeach;?>$meta_boxes_per_location=array();foreach($locationsas$location)$meta_boxes_per_location[$location]=array();if(!isset($wp_meta_boxes[$current_screen->id][$location]))continue;foreach($prioritiesas$priority)if(!isset($wp_meta_boxes[$current_screen->id][$location][$priority]))continue;$meta_boxes=(array)$wp_meta_boxes[$current_screen->id][$location][$priority];foreach($meta_boxesas$meta_box)if(false==$meta_box/**
	 * Sadly we probably can not add this data directly into editor settings.
	 *
	 * Some meta boxes need admin_head to fire for meta box registry.
	 * admin_head fires after admin_enqueue_scripts, which is where we create our
	 * editor instance.
	 */$script='window._wpLoadBlockEditor.then( function() 
		wp.data.dispatch( 'core/edit-post' ).setAvailableMetaBoxesPerLocation( '.wp_json_encode($meta_boxes_per_location).' );
	 );';wp_add_inline_script('wp-edit-post',$script);/**
	 * When `wp-edit-post` is output in the ``, the inline script needs to be manually printed. Otherwise,
	 * meta boxes will not display because inline scripts for `wp-edit-post` will not be printed again after this point.
	 */if(wp_script_is('wp-edit-post','done'))printf("n",trim($script));/**
	 * If the 'postcustom' meta box is enabled, then we need to perform some
	 * extra initialization on it.
	 */$enable_custom_fields=(bool)get_user_meta(get_current_user_id(),'enable_custom_fields',true);if($enable_custom_fields)$script="( function( $ ) 
			if ( $('#postcustom').length ) 
				$( '#the-list' ).wpList( 
					addBefore: function( s ) 
						s.data += '&post_id=$post->ID';
						return s;
					,
					addAfter: function() 
						$('table#list-table').show();
					
				);
			
		 )( jQuery );";wp_enqueue_script('wp-lists');wp_add_inline_script('wp-lists',$script);// Reset meta box data.$wp_meta_boxes=$_original_meta_boxes;

Relacionado

Usos

Usos Descripción
wp-admin / includes / post.php:the_block_editor_meta_box_post_form_hidden_fields ()

Muestra el formulario oculto necesario para el formulario de metacajas.

wp-admin / includes / post.php:filter_block_editor_meta_boxes

Se dispara justo antes de que se rendericen las metacajas.

wp-includes / functions.wp-scripts.php:wp_add_inline_script ()

Agrega código adicional a un script registrado.

wp-includes / functions.php:wp_json_encode ()

Codifique una variable en JSON, con algunas comprobaciones de cordura.

wp-admin / includes / template.php:do_meta_boxes ()

Función de plantilla Meta-Box.

wp-includes / formatting.php:esc_attr ()

Escapar de atributos HTML.

wp-includes / functions.wp-scripts.php:wp_script_is ()

Determina si se ha agregado un script a la cola.

wp-includes / functions.wp-scripts.php:wp_enqueue_script ()

Poner en cola un guión.

wp-includes / functions.php:wp_nonce_field ()

Recupere o muestre el campo oculto de nonce para formularios.

wp-includes / link-template.php:admin_url ()

Recupera la URL del área de administración del sitio actual.

wp-includes / plugin.php:aplicar_filtros ()

Llama a las funciones de devolución de llamada que se han agregado a un enlace de filtro.

wp-includes / user.php:get_user_meta ()

Recuperar metacampo de usuario para un usuario.

wp-includes / user.php:get_current_user_id ()

Obtener la identificación del usuario actual

Registro de cambios

Versión Descripción
5.0.0 Introducido.