Settings API – changing add_settings_field() output?

I’m using Settings API and wondering if there’s any way of editing default output of add_settings_field() function?

add_settings_field('the_field', 'bar', 'foo', 'page', 'section');      

function foo() {
    echo 'foo';
}

Outputs:

<table class="form-table">
  <tr valign="top">
    <th scope="row">bar</th>
    <td>foo</td>
    </tr>

How to get rid of these table tags and replace them with something else?

2 s
2

If you look at do_settings_fields() (line 1125, /wp-admin/includes/template.php), you can see that the table information is hardcoded into the the settings API. If you wish to not use the table, you will need to develop your own settings functions.

Leave a Comment