• Found empty settings checkbox labels in a non-english site for a third party plugin. Obviously the label field of a test can be empty under certain circumstances.

    Maybe add a fallback, similar to this:

    foreach ( $tests as $type ) {
    	foreach ( $type as $test => $details ) {
    		echo '<li><input type="checkbox"';
    		checked( ! in_array( $test, $disabled ) );
    		echo ' name="checked[]" id="' . $test . '" value="' . $test . '" />';
    		echo '<label for="' . $test . '">' . ( ! empty( $details['label'] ) ? $details['label'] : $test ) . '</label></li>';
    	}
    }

    This code also uses checked() WordPress function, maybe esc_attr() for attributes and esc_html() for label could/should be added as well.

    WordPress 5.4.2
    Site Health Tool Manager 1.1
    Yoast SEO 13.5

    • This topic was modified 4 years, 5 months ago by Ov3rfly.
    • This topic was modified 4 years, 5 months ago by Yui.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Empty checkbox labels in settings’ is closed to new replies.