WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/get field name

Description

This function is used to uniquely identify form fields in the configuration form of Widgets. It should be used to generate field-ids for labeling the form fields in the widget configuration form.

Example

function form( $instance ) {
?>

<p>
    <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label>
    <input type="text" value="<?php echo $instance['title']; ?>" name="<?php echo $this->get_field_name( 'title' ); ?>">
</p>
<?php
}

Source File

get_field_name is located in wp-includes/widgets.php.

See also index of Function Reference and index of Template Tags.