Title: post_format_meta_box
Published: April 25, 2014
Last modified: February 24, 2026

---

# post_format_meta_box( WP_Post $post, array $box )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#wp--skip-link--target)

Displays post format form elements.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#parameters)󠁿

 `$post`[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)required

Current post object.

`$box`arrayrequired

Post formats meta box arguments.

 * `id` string
 * Meta box `'id'` attribute.
 * `title` string
 * Meta box title.
 * `callback` callable
 * Meta box display callback.
 * `args` array
 * Extra meta box arguments.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#source)󠁿

    ```php
    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 endforeach; ?>
    		</fieldset>
    	</div>
    			<?php
    	endif;
    endif;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/meta-boxes.php#L518)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/meta-boxes.php#L518-L549)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#related)󠁿

| Uses | Description | 
| [get_theme_support()](https://developer.wordpress.org/reference/functions/get_theme_support/)`wp-includes/theme.php` |

Gets the theme support arguments passed when registering that support.

  | 
| [checked()](https://developer.wordpress.org/reference/functions/checked/)`wp-includes/general-template.php` |

Outputs the HTML checked attribute.

  | 
| [post_type_supports()](https://developer.wordpress.org/reference/functions/post_type_supports/)`wp-includes/post.php` |

Checks a post type’s support for a given feature.

  | 
| [get_post_format()](https://developer.wordpress.org/reference/functions/get_post_format/)`wp-includes/post-formats.php` |

Retrieve the format slug for a post

  | 
| [get_post_format_string()](https://developer.wordpress.org/reference/functions/get_post_format_string/)`wp-includes/post-formats.php` |

Returns a pretty, translated version of a post format slug

  | 
| [current_theme_supports()](https://developer.wordpress.org/reference/functions/current_theme_supports/)`wp-includes/theme.php` |

Checks a theme’s support for a given feature.

  | 
| [_e()](https://developer.wordpress.org/reference/functions/_e/)`wp-includes/l10n.php` |

Displays translated text.

  | 
| [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` |

Escaping for HTML attributes.

  | 
| [esc_html()](https://developer.wordpress.org/reference/functions/esc_html/)`wp-includes/formatting.php` |

Escaping for HTML blocks.

  |

[Show 4 more](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/post_format_meta_box/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fpost_format_meta_box%2F)
before being able to contribute a note or feedback.