Title: _list_meta_row
Published: April 25, 2014
Last modified: August 20, 2026

---

# _list_meta_row( array $entry, int $count ): string

## In this article

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

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

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

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

 `$entry`arrayrequired

An array of meta data keyed on `'meta_key'` and `'meta_value'`.

`$count`intrequired

Reference to the row number.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/_list_meta_row/?output_format=md#return)󠁿

 string A single row of public meta data.

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

    ```php
    function _list_meta_row( $entry, &$count ) {
    	static $update_nonce = '';

    	if ( is_protected_meta( $entry['meta_key'], 'post' ) ) {
    		return '';
    	}

    	if ( ! $update_nonce ) {
    		$update_nonce = wp_create_nonce( 'add-meta' );
    	}

    	$r = '';
    	++$count;

    	if ( is_serialized( $entry['meta_value'] ) ) {
    		if ( is_serialized_string( $entry['meta_value'] ) ) {
    			// This is a serialized string, so we should display it.
    			$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
    		} else {
    			// This is a serialized array/object so we should NOT display it.
    			--$count;
    			return '';
    		}
    	}

    	$entry['meta_key']   = esc_attr( $entry['meta_key'] );
    	$entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // Using a <textarea />.
    	$entry['meta_id']    = (int) $entry['meta_id'];

    	$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );

    	$r .= "\n\t<tr id='meta-{$entry['meta_id']}'>";
    	$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" .
    		/* translators: Hidden accessibility text. */
    		__( 'Key' ) .
    	"</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";

    	$r .= "\n\t\t<div class='submit'>";
    	$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" ) );
    	$r .= "\n\t\t";
    	$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" ) );
    	$r .= '</div>';
    	$r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
    	$r .= '</td>';

    	$r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" .
    		/* translators: Hidden accessibility text. */
    		__( '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>";
    	return $r;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/template.php#L633)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/template.php#L633-L683)

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

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

Returns a submit button, with provided text and appropriate class.

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

Escaping for textarea values.

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

Retrieves or display nonce hidden field for forms.

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

Checks value to find if it was serialized.

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

Checks whether serialized data is of string type.

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

Unserializes data only if it was serialized.

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

Determines whether a meta key is considered protected.

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

Retrieves the translation of $text.

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

Escaping for HTML attributes.

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

Creates a cryptographic token tied to a specific action, user, user session, and window of time.

  |

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

| Used by | Description | 
| [list_meta()](https://developer.wordpress.org/reference/functions/list_meta/)`wp-admin/includes/template.php` |

Outputs a post’s public meta data in the Custom Fields meta box.

  | 
| [wp_ajax_add_meta()](https://developer.wordpress.org/reference/functions/wp_ajax_add_meta/)`wp-admin/includes/ajax-actions.php` |

Handles adding meta via AJAX.

  |

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

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

## User Contributed Notes

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