WordPress-Coding-Standards
WordPress-Coding-Standards copied to clipboard
Flag when `checked()`, `selected()` etc should be used
What about a sniff to warn about code which does not use the WP helper functions - checked(), selected(), disabled(), wp_readonly()- for these form attributes ?
<!-- This should be flagged. -->
<input id="<?php echo esc_attr( $field_id ); ?>"
name="<?php echo esc_attr( $field_name ); ?>" type="checkbox"
class="prefix_classname"
value="1" <?php echo ! empty( $current_value ) ? ' checked="checked"' : ''; ?> />
<!-- This should not be flagged. -->
<input type="checkbox" id="input_field_id" checked="checked"/>
Loosely related to #346