Registra i meta box predefiniti dei post ed esegue il metodo do_meta_boxes azioni.

Parametri

$post

(WP_Post)(Richiesto)L'oggetto post per il quale vengono generati questi meta-box.

Fonte

File: wp-admin/includes/meta-boxes.php

functionregister_and_do_post_meta_boxes($post){$post_type=$post->post_type;$post_type_object=get_post_type_object($post_type);$thumbnail_support=current_theme_supports('post-thumbnails',$post_type)&&post_type_supports($post_type,'thumbnail');if(!$thumbnail_support&&'attachment'===$post_type&&$post->post_mime_type){if(wp_attachment_is('audio',$post)){$thumbnail_support=post_type_supports('attachment:audio','thumbnail')||current_theme_supports('post-thumbnails','attachment:audio');}elseif(wp_attachment_is('video',$post)){$thumbnail_support=post_type_supports('attachment:video','thumbnail')||current_theme_supports('post-thumbnails','attachment:video');}}$publish_callback_args=array('__back_compat_meta_box'=>true);if(post_type_supports($post_type,'revisions')&&'auto-draft'!==$post->post_status){$revisions=wp_get_post_revisions($post->ID,array('fields'=>'ids'));// We should aim to show the revisions meta box only when there are revisions.if(count($revisions)>1){$publish_callback_args=array('revisions_count'=>count($revisions),'revision_id'=>reset($revisions),'__back_compat_meta_box'=>true,);add_meta_box('revisionsdiv',__('Revisions'),'post_revisions_meta_box',null,'normal','core',array('__back_compat_meta_box'=>true));}}if('attachment'===$post_type){wp_enqueue_script('image-edit');wp_enqueue_style('imgareaselect');add_meta_box('submitdiv',__('Save'),'attachment_submit_meta_box',null,'side','core',array('__back_compat_meta_box'=>true));add_action('edit_form_after_title','edit_form_image_editor');if(wp_attachment_is('audio',$post)){add_meta_box('attachment-id3',__('Metadata'),'attachment_id3_data_meta_box',null,'normal','core',array('__back_compat_meta_box'=>true));}}else{add_meta_box('submitdiv',__('Publish'),'post_submit_meta_box',null,'side','core',$publish_callback_args);}if(current_theme_supports('post-formats')&&post_type_supports($post_type,'post-formats')){add_meta_box('formatdiv',_x('Format','post format'),'post_format_meta_box',null,'side','core',array('__back_compat_meta_box'=>true));}// All taxonomies.foreach(get_object_taxonomies($post)as$tax_name){$taxonomy=get_taxonomy($tax_name);if(!$taxonomy->show_ui||false===$taxonomy->meta_box_cb){continue;}$label=$taxonomy->labels->name;if(!is_taxonomy_hierarchical($tax_name)){$tax_meta_box_id='tagsdiv-'.$tax_name;}else{$tax_meta_box_id=$tax_name.'div';}add_meta_box($tax_meta_box_id,$label,$taxonomy->meta_box_cb,null,'side','core',array('taxonomy'=>$tax_name,'__back_compat_meta_box'=>true,));}if(post_type_supports($post_type,'page-attributes')||count(get_page_templates($post))>0){add_meta_box('pageparentdiv',$post_type_object->labels->attributes,'page_attributes_meta_box',null,'side','core',array('__back_compat_meta_box'=>true));}if($thumbnail_support&&current_user_can('upload_files')){add_meta_box('postimagediv',esc_html($post_type_object->labels->featured_image),'post_thumbnail_meta_box',null,'side','low',array('__back_compat_meta_box'=>true));}if(post_type_supports($post_type,'excerpt')){add_meta_box('postexcerpt',__('Excerpt'),'post_excerpt_meta_box',null,'normal','core',array('__back_compat_meta_box'=>true));}if(post_type_supports($post_type,'trackbacks')){add_meta_box('trackbacksdiv',__('Send Trackbacks'),'post_trackback_meta_box',null,'normal','core',array('__back_compat_meta_box'=>true));}if(post_type_supports($post_type,'custom-fields')){add_meta_box('postcustom',__('Custom Fields'),'post_custom_meta_box',null,'normal','core',array('__back_compat_meta_box'=>!(bool)get_user_meta(get_current_user_id(),'enable_custom_fields',true),'__block_editor_compatible_meta_box'=>true,));}/**
	 * Fires in the middle of built-in meta box registration.
	 *
	 * @since 2.1.0
	 * @deprecated 3.7.0 Use {@see 'add_meta_boxes'} instead.
	 *
	 * @param WP_Post $post Post object.
	 */do_action_deprecated('dbx_post_advanced',array($post),'3.7.0','add_meta_boxes');// Allow the Discussion meta box to show up if the post type supports comments,// or if comments or pings are open.if(comments_open($post)||pings_open($post)||post_type_supports($post_type,'comments')){add_meta_box('commentstatusdiv',__('Discussion'),'post_comment_status_meta_box',null,'normal','core',array('__back_compat_meta_box'=>true));}$stati=get_post_stati(array('public'=>true));if(empty($stati)){$stati=array('publish');}$stati[]='private';if(in_array(get_post_status($post),$stati,true)){// If the post type support comments, or the post has comments,// allow the Comments meta box.if(comments_open($post)||pings_open($post)||$post->comment_count>0||post_type_supports($post_type,'comments')){add_meta_box('commentsdiv',__('Comments'),'post_comment_meta_box',null,'normal','core',array('__back_compat_meta_box'=>true));}}if(!('pending'===get_post_status($post)&&!current_user_can($post_type_object->cap->publish_posts))){add_meta_box('slugdiv',__('Slug'),'post_slug_meta_box',null,'normal','core',array('__back_compat_meta_box'=>true));}if(post_type_supports($post_type,'author')&&current_user_can($post_type_object->cap->edit_others_posts)){add_meta_box('authordiv',__('Author'),'post_author_meta_box',null,'normal','core',array('__back_compat_meta_box'=>true));}/**
	 * Fires after all built-in meta boxes have been added.
	 *
	 * @since 3.0.0
	 *
	 * @param string  $post_type Post type.
	 * @param WP_Post $post      Post object.
	 */do_action('add_meta_boxes',$post_type,$post);/**
	 * Fires after all built-in meta boxes have been added, contextually for the given post type.
	 *
	 * The dynamic portion of the hook, `$post_type`, refers to the post type of the post.
	 *
	 * @since 3.0.0
	 *
	 * @param WP_Post $post Post object.
	 */do_action("add_meta_boxes_{$post_type}",$post);/**
	 * Fires after meta boxes have been added.
	 *
	 * Fires once for each of the default meta box contexts: normal, advanced, and side.
	 *
	 * @since 3.0.0
	 *
	 * @param string                $post_type Post type of the post on Edit Post screen, 'link' on Edit Link screen,
	 *                                         'dashboard' on Dashboard screen.
	 * @param string                $context   Meta box context. Possible values include 'normal', 'advanced', 'side'.
	 * @param WP_Post|object|string $post      Post object on Edit Post screen, link object on Edit Link screen,
	 *                                         an empty string on Dashboard screen.
	 */do_action('do_meta_boxes',$post_type,'normal',$post);/** This action is documented in wp-admin/includes/meta-boxes.php */do_action('do_meta_boxes',$post_type,'advanced',$post);/** This action is documented in wp-admin/includes/meta-boxes.php */do_action('do_meta_boxes',$post_type,'side',$post);}

Correlato

Utilizzi

Usi Descrizione
wp-includes/plugin.php: do_action_deprecated()

Lancia le funzioni collegate a un gancio di azione deprecato.

wp-includes/post.php: wp_attachment_is()

Verifica che un allegato sia di un determinato tipo.

wp-admin/includes/theme.php: get_page_templates()

Ottiene i modelli di pagina disponibili in questo tema.

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

Aggiunge un riquadro di meta a una o più schermate.

wp-admin/includes/meta-boxes.php: dbx_post_avanzato

Si attiva nel mezzo della registrazione dei meta-box integrati.

wp-admin/includes/meta-boxes.php: add_meta_boxes

Si attiva dopo che tutti i meta-box incorporati sono stati aggiunti.

wp-admin/includes/meta-boxes.php: add_meta_boxes_{$post_type}

Si attiva dopo che tutti i meta-box incorporati sono stati aggiunti, contestualmente al tipo di post indicato.

wp-admin/includes/meta-boxes.php: do_meta_boxes

Si attiva dopo l'aggiunta dei meta-box.

wp-includes/capabilities.php: current_user_can()

Restituisce se l'utente corrente ha la capacità specificata.

wp-includes/theme.php: current_theme_supports()

Verifica il supporto di un tema per una determinata caratteristica.

wp-includes/l10n.php: __()

Recupera la traduzione di $testo.

wp-includes/l10n.php: _x()

Recupera la stringa tradotta con il contesto gettext.

wp-includes/formatting.php: esc_html()

Escaping per i blocchi HTML.

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

Mette in attesa uno script.

wp-includes/taxonomy.php: get_object_taxonomies()

Restituisce i nomi o gli oggetti delle tassonomie registrate per l'oggetto o il tipo di oggetto richiesto, come il nome di un oggetto post o di un tipo di post.

wp-includes/taxonomy.php: get_taxonomy()

Recupera l'oggetto tassonomia di $taxonomy.

wp-includes/taxonomy.php: is_taxonomy_hierarchical()

Determina se l'oggetto tassonomia è gerarchico.

wp-includes/functions.wp-styles.php: wp_enqueue_style()

Richiama un foglio di stile CSS.

wp-includes/plugin.php: add_action()

Aggancia una funzione a un'azione specifica.

wp-includes/plugin.php: do_action()

Esegue le funzioni agganciate a un gancio di azione specifico.

wp-includes/user.php: get_user_meta()

Recupera il campo meta dell'utente per un utente.

wp-includes/user.php: get_current_user_id()

Ottiene l'ID dell'utente corrente

wp-includes/post.php: post_type_supports()

Controlla il supporto di un tipo di post per una determinata caratteristica.

wp-includes/post.php: get_post_type_object()

Recupera un oggetto di tipo post per nome.

wp-includes/post.php: get_post_stati()

Ottiene un elenco di stati dei post.

wp-includes/post.php: get_post_status()

Recupera lo stato del post in base all'ID del post.

wp-includes/revision.php: wp_get_post_revisioni()

Restituisce tutte le revisioni del post specificato.

wp-includes/comment-template.php: commenti_aperti()

Determina se il post corrente è aperto ai commenti.

wp-includes/comment-template.php: pings_open()

Determina se il post corrente è aperto per i ping.

Changelog

Versione Descrizione
5.0.0 Introdotto.