SAPI-generated field label truncated
-
All the labels for my fields are truncated to the first letter.
add_settings_field('yankit', 'Strip title', array($this, 'admin_form_checkbox'), __FILE__, 'main_section', 'yankit'); function admin_form_checkbox ( $f ) { echo "<input type='checkbox' id='$f' name='plugin_image-formatr[$f]' $checked/>"; }
This code generates the following output:
<tr valign="top"> <th scope="row"><label for="y">Strip title</label></th> <td><input type="checkbox" id="yankit" name="plugin_image-formatr[yankit]"></td> </tr>
The problem is the
<label for="y">
should be<label for="yankit">
so it’s trying to not have a bug but, it does. Any insight as to why the id reference is truncated?It is interesting to note that the definition for add_settings_field() in wp-admin/includes/template.php, the last argument is declared as an array and when an array parameter is passed, the label is not printed at all; and, to reiterate, when a string parameter is passed, the label is printed with a truncated id reference.
- The topic ‘SAPI-generated field label truncated’ is closed to new replies.