Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get field name


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.


function form( $instance ) {

    <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' ); ?>">

Source File

get_field_name is located in wp-includes/class-wp-widget.php.

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