post_format_meta_box

The timeline below displays how wordpress function post_format_meta_box has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Displays post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Current post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box 'id' attribute.
 *     @type string   $title    Meta box title.
 *     @type callable $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the active theme doesn't support it.
            if ($post_format && !in_array($post_format, $post_formats[0], true)) {
                $post_formats[0][] = $post_format;
            }
            ?>
		<div id="post-formats-select">
		<fieldset>
			<legend class="screen-reader-text">
				<?php 
            /* translators: Hidden accessibility text. */
            _e('Post Formats');
            ?>
			</legend>
			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
			<?php 
            foreach ($post_formats[0] as $format) {
                ?>
			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
			<?php 
            }
            ?>
		</fieldset>
	</div>
			<?php 
        }
    }
}

WordPress Version: 6.1

/**
 * Displays post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Current post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box 'id' attribute.
 *     @type string   $title    Meta box title.
 *     @type callable $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the active theme doesn't support it.
            if ($post_format && !in_array($post_format, $post_formats[0], true)) {
                $post_formats[0][] = $post_format;
            }
            ?>
		<div id="post-formats-select">
		<fieldset>
			<legend class="screen-reader-text"><?php 
            _e('Post Formats');
            ?></legend>
			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
			<?php 
            foreach ($post_formats[0] as $format) {
                ?>
			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
			<?php 
            }
            ?>
		</fieldset>
	</div>
			<?php 
        }
    }
}

WordPress Version: 5.5

/**
 * Display post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box 'id' attribute.
 *     @type string   $title    Meta box title.
 *     @type callable $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the current theme doesn't support it.
            if ($post_format && !in_array($post_format, $post_formats[0], true)) {
                $post_formats[0][] = $post_format;
            }
            ?>
		<div id="post-formats-select">
		<fieldset>
			<legend class="screen-reader-text"><?php 
            _e('Post Formats');
            ?></legend>
			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
			<?php 
            foreach ($post_formats[0] as $format) {
                ?>
			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
			<?php 
            }
            ?>
		</fieldset>
	</div>
			<?php 
        }
    }
}

WordPress Version: 5.4

/**
 * Display post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box 'id' attribute.
 *     @type string   $title    Meta box title.
 *     @type callable $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the current theme doesn't support it.
            if ($post_format && !in_array($post_format, $post_formats[0])) {
                $post_formats[0][] = $post_format;
            }
            ?>
		<div id="post-formats-select">
		<fieldset>
			<legend class="screen-reader-text"><?php 
            _e('Post Formats');
            ?></legend>
			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
			<?php 
            foreach ($post_formats[0] as $format) {
                ?>
			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
			<?php 
            }
            ?>
		</fieldset>
	</div>
			<?php 
        }
    }
}

WordPress Version: 5.1

/**
 * Display post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box 'id' attribute.
 *     @type string   $title    Meta box title.
 *     @type callable $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the current theme doesn't support it
            if ($post_format && !in_array($post_format, $post_formats[0])) {
                $post_formats[0][] = $post_format;
            }
            ?>
		<div id="post-formats-select">
		<fieldset>
			<legend class="screen-reader-text"><?php 
            _e('Post Formats');
            ?></legend>
			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
			<?php 
            foreach ($post_formats[0] as $format) {
                ?>
			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
			<?php 
            }
            ?>
		</fieldset>
	</div>
			<?php 
        }
    }
}

WordPress Version: 4.6

/**
 * Display post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box 'id' attribute.
 *     @type string   $title    Meta box title.
 *     @type callable $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the current theme doesn't support it
            if ($post_format && !in_array($post_format, $post_formats[0])) {
                $post_formats[0][] = $post_format;
            }
            ?>
	<div id="post-formats-select">
		<fieldset>
			<legend class="screen-reader-text"><?php 
            _e('Post Formats');
            ?></legend>
			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
			<?php 
            foreach ($post_formats[0] as $format) {
                ?>
			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
			<?php 
            }
            ?>
		</fieldset>
	</div>
	<?php 
        }
    }
}

WordPress Version: 4.4

/**
 * Display post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box ID.
 *     @type string   $title    Meta box title.
 *     @type callable $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the current theme doesn't support it
            if ($post_format && !in_array($post_format, $post_formats[0])) {
                $post_formats[0][] = $post_format;
            }
            ?>
	<div id="post-formats-select">
		<fieldset>
			<legend class="screen-reader-text"><?php 
            _e('Post Formats');
            ?></legend>
			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
			<?php 
            foreach ($post_formats[0] as $format) {
                ?>
			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
			<?php 
            }
            ?>
		</fieldset>
	</div>
	<?php 
        }
    }
}

WordPress Version: 4.3

/**
 * Display post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box ID.
 *     @type string   $title    Meta box title.
 *     @type callback $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the current theme doesn't support it
            if ($post_format && !in_array($post_format, $post_formats[0])) {
                $post_formats[0][] = $post_format;
            }
            ?>
	<div id="post-formats-select">
		<fieldset>
			<legend class="screen-reader-text"><?php 
            _e('Post Formats');
            ?></legend>
			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
			<?php 
            foreach ($post_formats[0] as $format) {
                ?>
			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
			<?php 
            }
            ?>
		</fieldset>
	</div>
	<?php 
        }
    }
}

WordPress Version: 4.0

/**
 * Display post format form elements.
 *
 * @since 3.1.0
 *
 * @param WP_Post $post Post object.
 * @param array   $box {
 *     Post formats meta box arguments.
 *
 *     @type string   $id       Meta box ID.
 *     @type string   $title    Meta box title.
 *     @type callback $callback Meta box display callback.
 *     @type array    $args     Extra meta box arguments.
 * }
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the current theme doesn't support it
            if ($post_format && !in_array($post_format, $post_formats[0])) {
                $post_formats[0][] = $post_format;
            }
            ?>
	<div id="post-formats-select">
		<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
		<?php 
            foreach ($post_formats[0] as $format) {
                ?>
		<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
		<?php 
            }
            ?><br />
	</div>
	<?php 
        }
    }
}

WordPress Version: 3.7

/**
 * Display post format form elements.
 *
 * @since 3.1.0
 *
 * @param object $post
 */
function post_format_meta_box($post, $box)
{
    if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
        $post_formats = get_theme_support('post-formats');
        if (is_array($post_formats[0])) {
            $post_format = get_post_format($post->ID);
            if (!$post_format) {
                $post_format = '0';
            }
            // Add in the current one if it isn't there yet, in case the current theme doesn't support it
            if ($post_format && !in_array($post_format, $post_formats[0])) {
                $post_formats[0][] = $post_format;
            }
            ?>
	<div id="post-formats-select">
		<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php 
            checked($post_format, '0');
            ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php 
            echo get_post_format_string('standard');
            ?></label>
		<?php 
            foreach ($post_formats[0] as $format) {
                ?>
		<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php 
                echo esc_attr($format);
                ?>" value="<?php 
                echo esc_attr($format);
                ?>" <?php 
                checked($post_format, $format);
                ?> /> <label for="post-format-<?php 
                echo esc_attr($format);
                ?>" class="post-format-icon post-format-<?php 
                echo esc_attr($format);
                ?>"><?php 
                echo esc_html(get_post_format_string($format));
                ?></label>
		<?php 
            }
            ?><br />
	</div>
	<?php 
        }
    }
}