WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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';


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

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

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
Indeed. Using do_settings_fields() is basically using the API to determine the output markup. Doing so has its advantages (UI consistency, forward-compatibility), but if you must output custom markup, then you'll have to omit the do_settings_fields() call, and add your own, custom markup. – Chip Bennett Feb 8 '12 at 20:52
Thanks! :) I knew about template.php, but was hoping it's still changeable. This whole Settings API looks amazing at first but after some digging it's not so easy to customize and use at all :) And all the tutorials make me just more confused :) – Wordpressor Feb 8 '12 at 21:06
As an author of one such tutorial, I'd love to know where you find it confusing, so that I can improve it. The intent is to eliminate confusion, rather than to create more. :) – Chip Bennett Feb 8 '12 at 21:12
It's really solid for just extending the core capabilities and core feel of wordpress. – mor7ifer Feb 8 '12 at 21:12
@Wordpressor There is version of the tutorial in one page. – toscho Feb 8 '12 at 22:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.