Skip to content

Administration: Restore the full-width upload folder row on Settings > Media - #13322

Open
dknauss wants to merge 1 commit into
WordPress:trunkfrom
dknauss:fix/51190-media-uploads-colspan
Open

Administration: Restore the full-width upload folder row on Settings > Media#13322
dknauss wants to merge 1 commit into
WordPress:trunkfrom
dknauss:fix/51190-media-uploads-colspan

Conversation

@dknauss

@dknauss dknauss commented Aug 30, 2026

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/51190

Problem

On Settings > Media, "Organize my uploads into month- and year-based folders" wraps onto three lines as soon as any plugin registers a field in the uploads settings section.

Cause

The row spanned both columns unconditionally until [40823] (#37004, HTML validation fixes) moved it inside the upload-path conditional in order to change its th to a td. That carried colspan="2" onto the editable-paths branch only:

<tr>
<td colspan="2" class="td-full">
<?php else : ?>
<tr>
<td class="td-full">
<?php endif; ?>

The else branch is what a site with default upload paths gets. With no fields registered the table has one column and the cell fills it, so nothing looks wrong. The do_settings_fields( 'media', 'uploads' ) call on the next line invites a second column, and once anything takes it, .form-table th { width: 200px } claims the first and the core label wraps.

forms.css dates the change from the other side: .form-table th.th-full, /* Not used by core. Back-compat for pre-4.8 */.

Fix

Close the conditional above the row and restore the single unconditional cell, keeping the td/td-full markup [40823] introduced.

Measured at a 1238px content width:

cell width label height
no plugin fields, no colspan (trunk) 1238px 17px
no plugin fields, colspan="2" 1238px 17px
one plugin field, no colspan (trunk) 210px 55px
one plugin field, colspan="2" 1238px 17px

The first two rows are identical because colspan="2" on a lone cell in a one-column table spans what it already spanned, so no check for registered fields is needed and rendering is unchanged for sites without them.

Testing instructions

  1. Make sure upload_path and upload_url_path are at their defaults, so the paths are locked (the common case).
  2. Visit Settings > Media and confirm the checkbox is on one line.
  3. Drop this in wp-content/mu-plugins/:
<?php
add_action( 'admin_init', function () {
	add_settings_field(
		'demo_field',
		'Demo Field',
		function () {
			echo '<input type="text" class="regular-text">';
		},
		'media',
		'uploads'
	);
} );
  1. Reload Settings > Media. On trunk the checkbox label wraps onto three lines in a 200px column; with this change it stays on one line and the new field renders below it.

Props imath for the report and diagnosis.

…> Media.

The "Organize my uploads into month- and year-based folders" row spanned both
columns unconditionally until [40823] moved it inside the upload-path
conditional in order to change its `th` to a `td`, and carried `colspan="2"`
onto only the editable-paths branch.

On the `else` branch — what a site with default upload paths gets — the cell
has no colspan. With no fields registered the table has one column and the cell
fills it, so nothing looks wrong. Any field added through the
`do_settings_fields( 'media', 'uploads' )` call on the next line gives the table
a second column, `.form-table th { width: 200px }` claims the first, and the
core label wraps onto three lines.

Closing the conditional above the row restores the single unconditional cell
while keeping the `td`/`td-full` markup [40823] introduced. Rendering is
unchanged when no fields are registered, since `colspan="2"` on a lone cell in a
one-column table spans what it already spanned.

See #51190.
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props dpknauss.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@dknauss

dknauss commented Aug 30, 2026

Copy link
Copy Markdown
Author

The props line above credits only me. imath reported this on #51190, worked out the cause, and attached the first patch — this PR takes a different route to the same fix, but the diagnosis is theirs.

For SVN:

Props imath, dpknauss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant