post_custom_meta_box

Display custom fields form fields.

Description

post_custom_meta_box( (object) $post ); 

Parameters (1)

0. $post (object)
The post.

Usage

  1. if ( !function_exists( 'post_custom_meta_box' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/meta-boxes.php'; 
  3.  
  4. // The post. 
  5. $post = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = post_custom_meta_box($post); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/meta-boxes.php  
  1. function post_custom_meta_box($post) { 
  2. ?> 
  3. <div id="postcustomstuff"> 
  4. <div id="ajax-response"></div> 
  5. <?php 
  6. $metadata = has_meta($post->ID); 
  7. foreach ( $metadata as $key => $value ) { 
  8. if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) ) 
  9. unset( $metadata[ $key ] ); 
  10. list_meta( $metadata ); 
  11. meta_form( $post ); ?> 
  12. </div> 
  13. <p><?php 
  14. printf( 
  15. /** translators: %s: Codex URL */ 
  16. __( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ),  
  17. __( 'https://codex.wordpress.org/Using_Custom_Fields' ) 
  18. ); 
  19. ?></p> 
  20. <?php