post_custom_meta_box
Display custom fields form fields.
Description
post_custom_meta_box( (object) $post );
Parameters (1)
- 0. $post (object)
- The post.
Usage
if ( !function_exists( 'post_custom_meta_box' ) ) { require_once ABSPATH . '/wp-admin/includes/meta-boxes.php'; } // The post. $post = null; // NOTICE! Understand what this does before running. $result = post_custom_meta_box($post);
Defined (1)
The function is defined in the following location(s).
- /wp-admin/includes/meta-boxes.php
- function post_custom_meta_box($post) {
- ?>
- <div id="postcustomstuff">
- <div id="ajax-response"></div>
- <?php
- $metadata = has_meta($post->ID);
- foreach ( $metadata as $key => $value ) {
- if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
- unset( $metadata[ $key ] );
- }
- list_meta( $metadata );
- meta_form( $post ); ?>
- </div>
- <p><?php
- printf(
- /** translators: %s: Codex URL */
- __( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ),
- __( 'https://codex.wordpress.org/Using_Custom_Fields' )
- );
- ?></p>
- <?php