add_theme_support( 'disable-layout-styles' ) looks like a tidy way to stop WordPress from writing layout CSS you didn’t ask for. It is that. It also hands your theme the job of rebuilding the content column, the alignwide cap, and the flex and grid rules behind Buttons, Columns and Social Icons.
This article covers what the flag removes, what survives it, what public evidence exists on how developers fare, and three ways to rebuild. The code claims come from reading WordPress core source at release tags 6.1.0 through 7.1.0 and trunk (7.2-alpha). I did not render the CSS in a browser, so the rebuild snippets are labelled as untested where that applies.
Key Takeaways
- The flag is checked in exactly two places in core, in every release from 6.1.0 to 7.1.0. It removes the base layout rules and the per-block
wp-container-*rules.- It does not remove
is-layout-*class names, and block themes withuseRootPaddingAwareAlignmentskeep the root-levelalignfullrules. What disappears is the content column and thealignwidecap.- No public benchmark isolates the flag’s byte savings, so a performance case for it is unsupported.
- Adopt the opt-out only if you will own a full replacement of the layout CSS in both the frontend and editor stylesheets.
What Does disable-layout-styles Actually Do?
The flag stops core from generating structural layout CSS, and it has done so since WordPress 6.1. The official Theme Support handbook says themes that opt out must supply their own structural styles. Otherwise Group, Columns, Buttons and Social Icons display incorrectly in the editor and on the frontend.
The 6.1 layout dev note (2022-10-10) explains why the flag exists. The original pull request framed it as a replacement for an older opt-out, removing a render callback, which stopped working once base styles moved into global styles.
I searched the source of each release tag for the string disable-layout-styles. The only hits are two lines per release, in block-supports/layout.php and class-wp-theme-json.php.
- Gate 1 is
get_layout_styles(), which returns an empty string when the flag is set. This removes the base rules for each layout type. - Gate 2 is the layout render filter, which skips building the per-block
wp-container-*rules and classes.
Neither gate has moved in substance across releases. Only the line numbers have, from 383 and 1026 in 6.1.0 to 1153 and 2224 in 7.1.0, because the files keep growing.
The editor follows the same flag. PHP passes disableLayoutStyles to the editor settings, and the 7.1 block-editor.js build skips layout CSS generation when it is true. Your editor stylesheet needs the same replacement rules as your frontend.
The Problem: What You Lose and What You Keep
The popular summary is “the flag breaks alignwide and alignfull.” That is only half right, and the difference matters when you plan the rebuild.
With the flag on, children of .is-layout-constrained lose their content-width max-width and auto margins. .alignwide loses its --wide-size cap. Wide and full blocks then have no column to break out of. Core also stops generating flex and grid display rules and the block-gap spacing, which is why Buttons and Columns stack vertically.
The class names and the root padding logic are a different story. A separate function, get_root_layout_rules(), sits outside both gates. It still emits the --wp--style--global--content-size and --wide-size variables when theme.json sets sizes. For block themes that set useRootPaddingAwareAlignments, it still emits the .has-global-padding > .alignfull negative-margin rules.
| Output | Removed by the flag? | Effect |
|---|---|---|
Constrained children: max-width plus auto margins | Yes | The content column disappears |
.alignwide capped at --wide-size | Yes | alignwide is no longer capped or centred |
.alignleft / .alignright / .aligncenter in constrained layouts | Yes | Floats and centring are lost |
| Flow, flex and grid base styles, plus gap | Yes | Buttons, Columns and Social Icons stack vertically |
Per-container rules such as $selector .alignfull { max-width: none } | Yes | Nested alignfull keeps any inherited max-width |
is-layout-* and has-global-padding class names | No | Classes remain as hooks for your CSS |
--content-size and --wide-size variables | No, when theme.json sets sizes | Variables stay, but nothing in core uses them |
.has-global-padding > .alignfull root-padding rules | No, but only with useRootPaddingAwareAlignments | Root-level alignfull can still bleed edge to edge |
Gallery was a late exception. Gutenberg PR #81633, opened 2026-08-14, makes the Gallery block skip its gap styles and unique class under the flag. One reviewer confirmed the gap no longer applies and that the columns are lost. Another core contributor said it is probably no longer a practical problem, because only a variable is output. I did not verify the merge status.
There is also no partial opt-out. I found no apply_filters call in trunk’s block-supports/layout.php, so wp_get_layout_definitions() cannot be filtered. The layout.definitions setting was removed from theme.json in 6.3. This is my reading of the source rather than a statement in the docs. You get the all-or-nothing flag, or you override in CSS.
The Evidence: What Developers Actually Report
I found real friction around core layout CSS. I did not find a measured pattern of developers disabling the styles and then regretting it. No Stack Overflow, Stack Exchange, Reddit or Hacker News thread about the flag itself surfaced in the research, and that absence is itself a finding.
Maintainers confirm the cost. The handbook and the 6.1 dev note both state the opt-out breaks core structural blocks unless you replace the CSS. A reporter in Gutenberg issue #60569 also expected the is-layout-* classes to disappear with the flag. They don’t, by design, and the styles architecture page says so.
The motive is overriding, not weight. Four independent reports describe core layout CSS beating theme CSS: Trac #60981, a wordpress.org thread on 6.5 output, a thread on narrower containers after 6.2, and Gutenberg #40159. In the 6.5 thread, one participant suggested the flag. In Trac #60981, a participant said it is not an option because too much functionality is lost.
Classic themes collide with block layout rules. PR #60489 accepts that always-on constrained rules overrode a classic theme’s .alignwide. Core now skips rules that reference the sizes when none are defined. A GeneratePress forum thread reports full width returning once theme.json is removed or sizes are set.
Removing core CSS wholesale collapses flex and grid. Trac #56970 and a developer gist describe blocks losing display: flex. These concern dequeuing global styles rather than the flag, so treat them as adjacent evidence.
Does the flag save performance?
Probably less than you expect, and nobody has measured it. Every byte figure I found covers a larger set of styles than the flag controls.
Inline CSS components in one default block theme Horizontal bar chart in kilobytes, approximate. Navigation block CSS about 17, gallery block CSS about 16, global styles about 7, core-block-supports about 1. Navigation block CSS ~17 KB Gallery block CSS ~16 KB Global styles (all) ~6-8 KB core-block-supports ~1 KB
Inline CSS in one default block theme on WordPress 7.0 (30+ style tags, about 43,000 characters in total). Self-reported by one developer and unreplicated. Source: cpoteet gist, updated 2026-07-10. Purple bars contain the layout rules the flag removes, alongside other styles.
The flag only trims the layout slice of global styles and the core-block-supports rules. In that breakdown the largest items are block stylesheets for navigation and gallery, which the flag does not touch. Core’s 6.9 frontend performance field guide (2025-11-18) raised the inline CSS budget from 20 KB to 40 KB and reports about 26% less CSS on average from loading block styles on demand in classic themes. That figure is about block styles, not layout styles, so don’t attribute it to the flag.
My inference, untested: a theme near the 40 KB inline budget can cross it with or without the flag.
Where the sources disagree
- Scope. The handbook names Group, Columns, Buttons and Social Icons and does not mention alignment or Gallery. The styles page mentions a default
max-widthfor constrained layouts. - Docs versus code. One report notes the handbook says base layout styles are always output for classic themes, while core changeset r58028 stopped emitting some flow and constrained base margin rules for classic themes without a theme.json (Trac #60981). The docs appear to lag the code.
- Inline tag counts. Core’s style engine note says layout rules are consolidated into fewer style tags since 6.1, while one developer reports 30+ inline tags. The note covers layout rules and the gist covers all block CSS, so these are not one measurement.
The Solution: Three Ways to Get the Grid Back
Choose by how much of the layout system you want to own. The code below is derived from core’s layout definitions and my reading of them. I did not test it on a live install.
Option A: Keep core’s styles and override them
Since WordPress 6.6, global styles use uniform 0-1-0 specificity, so a plain class selector in your stylesheet can win. This keeps alignfull and alignwide working without owning the full rule set. It does not remove the inline CSS. This is an inference from the specificity change, untested.
If your goal is only to tweak spacing, core’s own answer in the PR discussion is blockGap: null or theme.json settings, not the flag.
For classic themes, a maintainer’s recommended fix in Gutenberg #60413 is a minimal theme.json that defines only contentSize and wideSize. The theme stays classic.
Option B: Opt out and rebuild
- Keep the sizes in theme.json. Leave
settings.layout.contentSize,wideSizeanduseRootPaddingAwareAlignmentsin place so core still emits the size variables and root-padding rules. - Restore the constrained rules. This transcribes the
constrainedbase styles inwp_get_layout_definitions()(7.1.0 and trunk), plus one line marked as my addition:
.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
max-width: var(--wp--style--global--content-size);
margin-left: auto !important;
margin-right: auto !important;
}
.is-layout-constrained > .alignwide { max-width: var(--wp--style--global--wide-size); }
.is-layout-constrained > .alignleft { float: left; margin-inline: 0 2em; }
.is-layout-constrained > .alignright { float: right; margin-inline: 2em 0; }
.is-layout-constrained > .aligncenter { margin-left: auto !important; margin-right: auto !important; }
/* my addition, not from core: frees nested full-width blocks */
.is-layout-constrained .alignfull { max-width: none; }- Restore flow, flex, grid and gap. Core’s definitions also carry
display: flex,flex-wrap: wrap,align-items: center, griddisplayand block-gap margins. Copy them from the same function. A minimal starter, derived from those definitions:
.is-layout-flex { display: flex; flex-wrap: wrap; align-items: center; }
.is-layout-grid { display: grid; }- Load the same rules in the editor with
add_editor_style(), because the editor skips layout CSS under the flag. Editor wrapper markup differs from the frontend, so selectors may need adjusting. - Re-diff after every core release. block-supports/layout.php grew from about 19 KB at 6.1.0 to about 61 KB at 7.1.0. Some of that is unrelated features such as grid and responsive overrides, but a copied rule set will drift. Keep specificity low with
:where(), and avoid targetingwp-container-*classes, as the WordPress Developer Blog advises.
Option C: Replace max-width and auto margins with a named-line grid
Independent write-ups by Josh Comeau, Cloud Four and Finley describe grids where each child opts into a content, wide or full track. This is the adaptation for WordPress, assuming --content and --wide are lengths you define:
Named grid tracks for content, wide and full alignment Diagram of five columns. Outer gutters belong to full, the next columns add wide, and the centre column is content. full (spans every track) wide content
Each block places itself in one named track. Illustration of the layout used in the CSS below.
.wp-block-post-content {
display: grid;
grid-template-columns:
[full-start] minmax(1rem, 1fr)
[wide-start] minmax(0, calc((var(--wide) - var(--content)) / 2))
[content-start] min(var(--content), 100% - 2rem) [content-end]
minmax(0, calc((var(--wide) - var(--content)) / 2)) [wide-end]
minmax(1rem, 1fr) [full-end];
}
.wp-block-post-content > * { grid-column: content; }
.wp-block-post-content > .alignwide { grid-column: wide; }
.wp-block-post-content > .alignfull { grid-column: full; }Limit: this places direct children only. Blocks nested inside a Group with its own constrained layout will not pick up the tracks unless you use subgrid, as Finley’s example does. This is an untested adaptation.
Regression checklist
alignwideandalignfullat the post-content root, inside a Group, inside Columns and inside Cover.- Buttons justification, Columns stacking, Social Icons and Gallery.
- Block gap spacing, and the editor canvas as well as the frontend.
Is the Flag Still Supported?
Yes, as far as any source shows. The latest stable releases are 7.1.2 and 7.0.6 (2026-09-22) per the WordPress versions page, the handbook styles page (updated 2026-09-15) still documents the flag, and I found no deprecation notice. Issue #39336, which asks to hide editor layout controls that have no output under the flag, was still unchecked when I retrieved it. The Gallery fix in August 2026 shows individual blocks are still being brought under the opt-out. No source states a roadmap.
Conclusion
The flag trades a predictable cascade for a maintenance obligation. In practice:
- It removes the content column, the
alignwidecap, flex and griddisplay, and gap, in the editor and on the frontend. - It keeps the class names, the size variables and, with
useRootPaddingAwareAlignments, root-levelalignfull. - Its performance payoff is unmeasured in public.
- Overriding core’s 0-1-0 selectors is often cheaper than owning a replacement, but I haven’t tested that.
Use the flag only when you commit to the replacement CSS in both stylesheets and a re-diff against core with each release. Otherwise start with Option A.
FAQs
useRootPaddingAwareAlignments keep the root-level .has-global-padding > .alignfull rules, because a function outside both gates emits them. Nested alignfull loses its max-width: none rule. This comes from reading source, not a browser test. is-layout-* and has-global-padding class names stay in the markup so your own CSS can target them. Related Citations & References
- DETheme Support – Block Editor Handbook | Developer.WordPress.org
- DETheme Support – Block Editor Handbook | Developer.WordPress.org
- DEStyles in the Editor – Block Editor Handbook | Developer.WordPress.org
- MAUpdated editor layout support in 6.1 after refactor – Make WordPress Core
- DEA walk-through of layout classes in WordPress 6.1 – WordPress Developer Blog
- MABlock Editor Theme-related updates in WordPress 5.3 – Make WordPress Core
- DEwp_enqueue_global_styles() – Function | Developer.WordPress.org
- GIwordpress-develop/src/wp-includes/block-supports/layout.php at trunk · WordPress/wordpress-develop · GitHub
- GIwordpress-develop/src/wp-includes/class-wp-theme-json.php at trunk · WordPress/wordpress-develop · GitHub
- GILayout: Add a disable-layout-styles theme supports flag to opt out of all layout styles by andrewserong · Pull Request #42544 · WordPress/gutenberg · GitHub
- GILayout: Removal of semantic classnames when using 'disable-layout-styles' · Issue #60569 · WordPress/gutenberg · GitHub
- GILayout: Always add semantic classes by Mamaduka · Pull Request #60668 · WordPress/gutenberg · GitHub
- GI6.5: Maximum width of wide blocks inside group set to Alignment: Full is overwritten in classic themes · Issue #60413 · WordPress/gutenberg · GitHub
- GILayout: Skip outputting base layout rules that reference content or wide sizes if no layout sizes exist by andrewserong · Pull Request #60489 · WordPress/gutenberg · GitHub
- GIDon't output base flow and constrained layout rules on themes without theme.json by tellthemachines · Pull Request #60764 · WordPress/gutenberg · GitHub
- GICannot apply wide or full widths to nested blocks with theme.json applied · Issue #33374 · WordPress/gutenberg · GitHub
- GINew inline CSS rules for nested blocks difficult to override · Issue #36135 · WordPress/gutenberg · GitHub
- GIOption to disable inline style for Group block · Issue #35811 · WordPress/gutenberg · GitHub
- GIBig styling / specifity problems with WP 6.0 · Issue #41760 · WordPress/gutenberg · GitHub
- GIHow to remove extra global-styles-inline-css? · Issue #36834 · WordPress/gutenberg · GitHub
- GIFully remove WP core-block-supports-inline-css styles in a theme. · Issue #56065 · WordPress/gutenberg · GitHub
- GISetting to disable Layout controls · Issue #31980 · WordPress/gutenberg · GitHub
- GIDon't output base flow and constrained layout rules on themes without theme.json. by tellthemachines · Pull Request #6410 · WordPress/wordpress-develop · GitHub
- CO60981
- LI[wp-trac] [WordPress Trac] #60936: Layout: Output of base layout rules conflicts with wide alignment of blocks in classic themes
- CO58890
- CO61008
- LI[wp-trac] [WordPress Trac] #64408: Global Styles: Lift restrictions on global styles for classic themes
- LI[wp-trac] [WordPress Trac] #65336: global-styles-inline-css cannot be removed since 7.0
- WOPreventing Output Of Layout Styles But Keep The Layout Classes In Core Block Edi
- WOHybrid theme not accessing alignwide class | WordPress.org
- WOWordPress 6.9 adds global-styles-inline-css and wp-block-paragraph-inline-css | WordPress.org
- STRemove Inline Block Css In WordPress 6 9
- STWordPress Gutenberg Fse Annoying Inline Css
- STRemove Inline Styling From Gutenberg Block Gallery
- CSUsing The New Constrained Layout In WordPress Block Themes | CSS-Tricks
- GIMoving WordPress Block Theme Inline Styles to a Tag · GitHub




