On this page
wp_required_field_indicator(): string
Assigns a visual indicator for required form fields.
Return
string Indicator glyph wrapped in a span tag.
Source
File: wp-includes/general-template.php. View all references
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 );
}
Hooks
- apply_filters( 'wp_required_field_indicator',
string $indicator ) -
Filters the markup for a visual indicator of required form fields.
Related
Uses
| Uses | Description |
|---|---|
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| esc_html() wp-includes/formatting.php | Escaping for HTML blocks. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| wp_required_field_message() wp-includes/general-template.php | Creates a message to explain required form fields. |
| wp_media_insert_url_form() wp-admin/includes/media.php | Creates the form for external url. |
| get_media_item() wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| get_compat_media_markup() wp-admin/includes/media.php | |
| comment_form() wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
Changelog
| Version | Description |
|---|---|
| 6.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_required_field_indicator