WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/do meta boxes

Contents

Description

Outputs all metaboxes registered to a specific page and context. Meta boxes should be registered using the add_meta_box() function.

Usage

 <?php
do_meta_boxes
$page$context$object );
?> 

Parameters

$page
(string) (required) The slug of the page to which the meta box was registered
Default: None
$context
(string) (required) The context in which the meta box was registered
Default: None
$object
(string) (required) Passed to the meta box's callback function as the first argument
Default: None

Example

Here is an example that uses add_meta_box to register a new meta box, then outputs that meta box using this do_meta_boxes function:

<?php
add_meta_box( 
    'my-custom-meta-box',
    __( 'My Custom Meta Box' ),
    'my_custom_menu_page',
    'normal' );

do_meta_boxes( 'my_custom_menu_page', 'normal' );
?> 

Source File

The do_meta_boxes() function is located in wp-admin/includes/template.php

See also index of Function Reference and index of Template Tags.