Make WordPress Core

Opened 6 years ago

Last modified 6 years ago

#20110 closed enhancement

Add a valued() function to encourage consistency in input fields — at Initial Version

Reported by: jeremyfelt Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords: close
Focuses: Cc:


A valued() function would fit well with the helper functions selected() and checked().

Makes it easier to add a value if it exists, and to escape the value with esc_attr().

Makes it easier to provide a placeholder text.

Use would be:

<input type="text" <?php echo valued( $possible_num, true, '4 digit number' ); ?>>

Which would result in:

<input type="text" value="1234" placeholder="4 digit number">


<input type="text" placeholder="4 digit number">

(Depending on the original value of $possible_num)

Change History (1)

6 years ago

Note: See TracTickets for help on using tickets.