Skip to content

Commit 8116729

Browse files
committed
Merge pull request #40 from roidayan/add_section_callback_option
Allow to specify callback for section
2 parents eaacd6a + 25927c0 commit 8116729

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/class.settings-api.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ function admin_init() {
113113
if ( isset($section['desc']) && !empty($section['desc']) ) {
114114
$section['desc'] = '<div class="inside">'.$section['desc'].'</div>';
115115
$callback = create_function('', 'echo "'.str_replace('"', '\"', $section['desc']).'";');
116+
} else if ( isset( $section['callback'] ) ) {
117+
$callback = $section['callback'];
116118
} else {
117-
$callback = '__return_false';
119+
$callback = null;
118120
}
119121

120122
add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );

0 commit comments

Comments
 (0)