Fix select-name in WordPress
WooCommerce themes frequently override loop/orderby.php and strip the aria-label from <select name='orderby'>, while classic WordPress Archive/Category dropdown widgets render unlabeled <select> elements. Restoring <label for> (or aria-label via esc_attr__()) clears the critical failure across every shop and blog archive.
Before and after
<?php // woocommerce/loop/orderby.php (Broken custom override missing label/aria-label) ?>
<form class="woocommerce-ordering" method="get">
<select name="orderby" class="orderby">
<?php foreach ( $catalog_orderby_options as $id => $name ) : ?>
<option value="<?php echo esc_attr( $id ); ?>" <?php selected( $orderby, $id ); ?>>
<?php echo esc_html( $name ); ?>
</option>
<?php endforeach; ?>
</select>
</form><?php // woocommerce/loop/orderby.php (Fixed with wp_unique_id() + accessible <label>) ?>
<?php $orderby_id = wp_unique_id( 'wc-orderby-' ); ?>
<form class="woocommerce-ordering" method="get">
<label for="<?php echo esc_attr( $orderby_id ); ?>" class="screen-reader-text">
<?php esc_html_e( 'Sort products by', 'mytheme' ); ?>
</label>
<select
id="<?php echo esc_attr( $orderby_id ); ?>"
name="orderby"
class="orderby"
>
<?php foreach ( $catalog_orderby_options as $id => $name ) : ?>
<option value="<?php echo esc_attr( $id ); ?>" <?php selected( $orderby, $id ); ?>>
<?php echo esc_html( $name ); ?>
</option>
<?php endforeach; ?>
</select>
</form>Fixed vs. broken example
Avoid relying on a dummy first <option> like "Sort by..." as the sole label; once a user picks an option, the purpose disappears for everyone.
Playwright + axe-core check
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
test("WooCommerce catalog ordering and product variation selects pass select-name", async ({ page }) => {
await page.goto("/shop/");
await expect(page.getByRole("combobox", { name: /sort products by/i })).toBeVisible();
const results = await new AxeBuilder({ page })
.withRules(["select-name"])
.analyze();
expect(results.violations).toEqual([]);
});Template deduplication tip
An unlabeled <select name='orderby'> in woocommerce/loop/orderby.php fires on every shop, category, and tag archive URL. Fixing that one PHP template override resolves the entire store cluster.
What NVDA and VoiceOver announce
E-commerce variant pickers (Size, Color), collection sort dropdowns, and country selectors without a programmatic <label> or aria-label announce only the first option ('Featured' or 'Small'), hiding what the dropdown controls.
NVDA (Windows)
"combo box, Featured, collapsed" (purpose of selector unknown)
"Sort products by, combo box, Featured, collapsed"
VoiceOver (macOS / iOS)
"Featured, pop-up button"
"Sort products by, Featured, pop-up button"
Common questions
Why did my WooCommerce shop fail select-name after installing a custom theme?
How do I label WordPress's wp_dropdown_categories() widget output?
id argument to wp_dropdown_categories( array( 'id' => 'cat-filter' ) ) and print a matching <label for='cat-filter'>Filter by category</label> immediately before it.Do WooCommerce Select2/SelectWoo enhanced dropdowns also need a label?
Test a URL for select-name
Enter any public URL for a free WCAG 2.2 AA check—no account or credit card required.
Managing WordPress client sites? Monitor 15 sites on one flat plan with white-label portals and branded executive PDFs—$1,140/yr ($95/mo billed annually, 24-month rate lock + onboarding) for Founding 10 agencies.