[wp-trac] [WordPress Trac] #65027: Add ID do Section titles generated by Settings API
WordPress Trac
noreply at wordpress.org
Mon Apr 6 15:15:59 UTC 2026
#65027: Add ID do Section titles generated by Settings API
-----------------------------------------------+---------------------------
Reporter: wetah | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Administration | Version:
Severity: trivial | Keywords:
Focuses: ui, accessibility, administration |
-----------------------------------------------+---------------------------
I see that there's a lot of debate around improvements to the Forms
generated by
[https://developer.wordpress.org/reference/functions/do_settings_sections/
do_settings_sections].
- https://core.trac.wordpress.org/ticket/51086
- https://core.trac.wordpress.org/ticket/43303
- https://core.trac.wordpress.org/ticket/39441
I know more radical changes won't move up easily so I would like to
suggest a simple one: having the section ID in the section title. For
instance this:
{{{#!php
<?php
if ( $section['title'] ) {
echo "<h2>{$section['title']}</h2>\n";
}
}}}
To become something like this:
{{{#!php
<?php
if ( $section['title'] ) {
echo '<h2 id="' . $section['id'] . '">' . $section['title'] .
'</h2>\n';
}
}}}
For consistency, I would add the IDs also to the Core forms that have
sections not generated by ''do_settings_sections'', such as ''options-
media.php'', ''options-reading.php'', etc. They already do something
different which is to add a 'title' class to all their section titles.
This makes me think that maybe we should have a filter to change that
title markup in the end... but that can be for another topic.
The main motivation for doing that is to allow hash navigation via URL. We
could easily in the documentation have links such as ''wp-admin/options-
discussion.php#avatars'', which I think it is a huge benefit if we're
talking long forms. I know it wouldn't solve more complex issues but can
be beneficial even for Accessibility and for those who want to customize
their forms via CSS, as discussed in the other linked tickets.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65027>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list