_list_meta_row

Outputs a single row of public meta data in the Custom Fields meta box.

Description

(string) _list_meta_row( (array) $entry, (number) &$count ); 

Returns (string)

Parameters (2)

0. $entry (array)
The entry.
1. $count (number) => &$count
The count.

Usage

  1. if ( !function_exists( '_list_meta_row' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/template.php'; 
  3.  
  4. // The entry. 
  5. $entry = array(); 
  6.  
  7. // The count. 
  8. $count = &$count; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _list_meta_row($entry, $count); 
  12.  

Defined (1)

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

/wp-admin/includes/template.php  
  1. function _list_meta_row( $entry, &$count ) { 
  2. static $update_nonce = ''; 
  3.  
  4. if ( is_protected_meta( $entry['meta_key'], 'post' ) ) 
  5. return ''; 
  6.  
  7. if ( ! $update_nonce ) 
  8. $update_nonce = wp_create_nonce( 'add-meta' ); 
  9.  
  10. $r = ''; 
  11. ++ $count; 
  12.  
  13. if ( is_serialized( $entry['meta_value'] ) ) { 
  14. if ( is_serialized_string( $entry['meta_value'] ) ) { 
  15. // This is a serialized string, so we should display it. 
  16. $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); 
  17. } else { 
  18. // This is a serialized array/object so we should NOT display it. 
  19. --$count; 
  20. return ''; 
  21.  
  22. $entry['meta_key'] = esc_attr($entry['meta_key']); 
  23. $entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a <textarea /> 
  24. $entry['meta_id'] = (int) $entry['meta_id']; 
  25.  
  26. $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] ); 
  27.  
  28. $r .= "\n\t<tr id='meta-{$entry['meta_id']}'>"; 
  29. $r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />"; 
  30.  
  31. $r .= "\n\t\t<div class='submit'>"; 
  32. $r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) ); 
  33. $r .= "\n\t\t"; 
  34. $r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) ); 
  35. $r .= "</div>"; 
  36. $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); 
  37. $r .= "</td>"; 
  38.  
  39. $r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>"; 
  40. return $r;