Skip to content

Commit

Permalink
Update conditional check for settings_fields in settings_section
Browse files Browse the repository at this point in the history
When a section did not have fields attached, the loop moved to the next item. This change makes sure the `after_section` argument gets printed.
  • Loading branch information
alpipego committed Dec 28, 2024
1 parent 779ed48 commit 1cd69de
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/wp-admin/includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1784,12 +1784,11 @@ function do_settings_sections( $page ) {
call_user_func( $section['callback'], $section );
}

if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
continue;
if ( isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
echo '<table class="form-table" role="presentation">';
do_settings_fields( $page, $section['id'] );
echo '</table>';
}
echo '<table class="form-table" role="presentation">';
do_settings_fields( $page, $section['id'] );
echo '</table>';

if ( '' !== $section['after_section'] ) {
echo wp_kses_post( $section['after_section'] );
Expand Down

0 comments on commit 1cd69de

Please sign in to comment.