wp_required_field_indicator

The timeline below displays how wordpress function wp_required_field_indicator has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Assigns a visual indicator for required form fields.
 *
 * @since 6.1.0
 *
 * @return string Indicator glyph wrapped in a `span` tag.
 */
function wp_required_field_indicator()
{
    /* translators: Character to identify required form fields. */
    $glyph = __('*');
    $indicator = '<span class="required">' . esc_html($glyph) . '</span>';
    /**
     * Filters the markup for a visual indicator of required form fields.
     *
     * @since 6.1.0
     *
     * @param string $indicator Markup for the indicator element.
     */
    return apply_filters('wp_required_field_indicator', $indicator);
}