WordPress at Your Fingertips
function is not described

WP_Widget::get_field_id() public WP 2.8.0

This function should be used in form() methods to create id attributes for fields to be saved by WP_Widget::update().

{} It's a method of the class: WP_Widget{}

No Hooks.

Return

String. ID attribute for $field_name.

Usage

$WP_Widget = new WP_Widget();
$WP_Widget->get_field_id( $field_name );
$field_name(string) (required)
Field name.

Changelog

Since 4.4.0 Array format field IDs are now accepted.

Code of WP_Widget::get_field_id() WP 5.8.3

public function get_field_id( $field_name ) {
	$field_name = str_replace( array( '[]', '[', ']' ), array( '', '-', '' ), $field_name );
	$field_name = trim( $field_name, '-' );

	return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name;
}