Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Define free-form CSS custom properties in settings.custom, reference them in the styles tree with WordPress token syntax, and use the generated --wp--custom--... variables in ordinary CSS. Use registered presets for values that should appear as standardized Site Editor controls, such as colors, font sizes, spacing, and shadows.

This approach gives the editor and the front end the same token values while keeping your theme’s design decisions in one place.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What WordPress generates from theme.json

A block theme’s theme.json is both a configuration file and a source for generated CSS. Values declared in the file can be consumed by WordPress style definitions and by your own stylesheet. When a value is declared under settings.custom, WordPress automatically turns its key path into a CSS custom-property name, assigns the value, and loads that property for the editor and the front end.

For example, this declaration creates two custom properties:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
{
  "settings": {
    "custom": {
      "lineHeight": {
        "sm": "1.25",
        "md": "1.5"
      }
    }
  }
}

The resulting names are equivalent to:

--wp--custom--line-height--sm: 1.25;
--wp--custom--line-height--md: 1.5;

The conversion is systematic:

  • The custom namespace becomes --wp--custom.
  • Each key is converted to kebab case, so lineHeight becomes line-height.
  • Each nested object adds another ---separated segment.

A practical nesting depth is preferable. Deeper objects create longer names that are harder to read and maintain, even though WordPress can generate them.

Define a custom property in settings.custom

Use settings.custom for free-form theme tokens that do not belong to one of WordPress’s standardized preset collections. The object can contain a single value or nested groups of values.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A single custom token

{
  "settings": {
    "custom": {
      "contentWidth": "70rem"
    }
  }
}

This produces a property equivalent to --wp--custom--content-width: 70rem.

A grouped set of tokens

{
  "settings": {
    "custom": {
      "lineHeight": {
        "sm": "1.25",
        "md": "1.5",
        "lg": "1.75"
      },
      "contentWidth": {
        "narrow": "42rem",
        "wide": "75rem"
      }
    }
  }
}

The generated names are equivalent to --wp--custom--line-height--sm, --wp--custom--line-height--md, --wp--custom--line-height--lg, --wp--custom--content-width--narrow, and --wp--custom--content-width--wide.

Choose key names for the meaning of a token rather than for one particular selector. A token named lineHeight.md can then be reused by paragraphs, headings, or a block style without renaming it when the design evolves.

Custom properties versus registered presets

Both systems produce CSS variables, but they solve different problems. Use a custom setting when the value is a theme-specific implementation token. Use a preset when WordPress already defines a supported design feature and you want the Site Editor to treat it as a standardized, user-facing option.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
Decision point settings.custom Standard preset
Purpose Free-form theme token for any value your design system needs. Standardized value for a supported feature such as color, font size, font family, spacing, or shadow.
Editor presentation Not automatically a standardized control in the Site Editor. Designed to participate in the corresponding Site Editor feature.
Generated namespace --wp--custom--... --wp--preset--{feature}--{slug}
theme.json reference var:custom|... var:preset|...
Typical example var:custom|line-height|md var:preset|color|primary
Best fit Internal spacing ratios, line-height scales, layout limits, or another token with no matching preset collection. A value that should have WordPress’s conventional naming, classes, and user controls.

Do not create a custom color token merely to avoid defining a palette entry if the color is intended to be selected or changed through the editor. A palette entry communicates that intent and gives WordPress the standardized preset namespace.

A complete theme.json example

The following version 2 example defines a custom line-height scale, registers a color palette entry, and consumes both tokens in global and block-specific styles.

{
  "$schema": "https://schemas.wp.org/trunk/theme.json",
  "version": 2,
  "settings": {
    "custom": {
      "lineHeight": {
        "sm": "1.25",
        "md": "1.5"
      }
    },
    "color": {
      "palette": [
        {
          "name": "Primary",
          "slug": "primary",
          "color": "#1e40af"
        }
      ]
    }
  },
  "styles": {
    "typography": {
      "lineHeight": "var:custom|line-height|md"
    },
    "color": {
      "text": "var:preset|color|primary"
    },
    "blocks": {
      "core/paragraph": {
        "typography": {
          "lineHeight": "var:custom|line-height|sm"
        }
      }
    }
  }
}

In this example, the body-level typography uses the medium custom line height, body text uses the registered primary color, and paragraphs override the line height with the smaller value. The corresponding generated variables are equivalent to:

body {
  --wp--custom--line-height--sm: 1.25;
  --wp--custom--line-height--md: 1.5;
  --wp--preset--color--primary: #1e40af;
}

The exact emitted stylesheet can include additional WordPress-generated rules, but these are the token names your CSS and style references should target.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reference tokens inside theme.json styles

Inside theme.json, do not write the ordinary CSS form var(--wp--...). WordPress’s style engine uses a pipe-delimited token reference.

Custom token syntax

"lineHeight": "var:custom|line-height|md"

The segments after custom follow the generated property path. A nested lineHeight.md object therefore uses var:custom|line-height|md.

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Preset token syntax

"text": "var:preset|color|primary"

The first segment identifies the preset feature, and the last segment is the preset slug. For a palette entry with the slug primary, the generated variable follows the pattern --wp--preset--color--primary.

Where style references belong

WordPress supports global styles, semantic elements, and block styles in the styles tree. Put a value at the narrowest level that expresses its intent:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Location Use it for Generated scope
styles Defaults shared by the page, such as global typography or text color. Top-level rules emitted for the body selector.
styles.elements Semantic elements supported by the global styles system, such as links or headings. Rules for the corresponding semantic element.
styles.blocks A block-specific exception or default, such as a paragraph line height. Rules emitted for that block’s selector.

Keeping the declaration in settings and the consumption in styles separates a token’s definition from the places where it is applied. It also lets WordPress expose supported style properties through Appearance > Editor > Styles.

Use generated variables in ordinary CSS

In a stylesheet, use the standard CSS custom-property function. The WordPress token syntax is only for values inside theme.json.

.example-class {
  line-height: var(--wp--custom--line-height--md);
  color: var(--wp--preset--color--primary);
}

This works because WordPress loads the generated variables for both the editor and the front end. A class in an external stylesheet, or CSS entered through the styles.css field, can consume the same token names as the style engine.

Use the exact generated spelling. --wp--custom--lineHeight--md will not match the generated --wp--custom--line-height--md, because camelCase keys are converted to kebab case.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Choose between theme.json and style.css

Start with theme.json when the value maps to a standard WordPress style property. This is the path that gives users the best chance to adjust the value through the Site Editor and keeps editor and front-end rendering aligned.

Prefer theme.json when

  • The value is a color, font size, font family, spacing value, shadow, or another supported style feature.
  • The value should be available through Appearance > Editor > Styles.
  • You are applying it globally, to a semantic element, or to a block through the styles tree.
  • You want WordPress to generate the standard preset naming and related classes.

Use stylesheet CSS when

  • The selector is outside the standard global-styles model.
  • The property or CSS feature is not represented by a supported theme.json style property.
  • You need a component-specific rule, pseudo-element, state selector, or other selector-level behavior that the style tree cannot express.

Even when the declaration is in a stylesheet, keep the token itself in settings.custom when it is a reusable theme value. The stylesheet should consume the variable rather than duplicate its literal value.

Normal CSS cascade and specificity still apply. A later or more specific rule can override a declaration that consumes a variable, and a block rule can override a global rule. Custom properties do not remove the need to inspect the selector and the order in which styles are loaded.

Step-by-step: add and use a custom token

  1. Open the active theme’s theme.json. Work in the theme file that WordPress actually loads, and preserve the file’s existing top-level structure.
  2. Add a settings.custom object. Define a meaningful key and value. For grouped values, use one nested object per scale or category.
  3. Predict the generated name. Convert camelCase keys to kebab case and join nested keys with --. For lineHeight.md, the result is --wp--custom--line-height--md.
  4. Apply the token through a supported style property when possible. In the styles tree, reference it with var:custom|..., not the CSS var() form.
  5. Apply it in a stylesheet when the selector requires ordinary CSS. Use var(--wp--custom--...) exactly as WordPress generated it.
  6. Reload both editing contexts. Check the Site Editor and the front end. The generated CSS is intended to be available in both, so a discrepancy usually indicates a JSON error, a selector/cascade issue, or a context-specific rule.
  7. Inspect the computed rule. Confirm that the consuming declaration is present and that the custom property resolves to the expected value. If it is crossed out, investigate specificity or source order rather than changing the token name.

Step-by-step: register a value as a preset

  1. Identify the supported feature. Use the documented settings collection for the value: colors, font sizes, font families, spacing, shadows, or another supported preset group.
  2. Give the value a stable slug. The slug becomes part of the generated name, so avoid presentation-specific names that will become misleading after a redesign.
  3. Define the preset in its collection. A color, for example, belongs in the color palette rather than in settings.custom.
  4. Reference it in theme.json. Use var:preset|{feature}|{slug}.
  5. Use the generated CSS form when needed. In a stylesheet, the same color preset follows --wp--preset--{feature}--{slug}.

Presets are UI-oriented tokens: WordPress can provide standardized names and controls for them. Custom settings remain the better choice when there is no matching feature or when the value is an internal implementation detail.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How the editor and front end stay in sync

WordPress emits the generated custom-property declarations for the editor and for the front end. A block preview in the Site Editor can therefore use the same token as the published page instead of maintaining a separate editor-only value.

The shared token does not guarantee that every selector has identical styling. The editor may add its own wrapper or block classes, and your stylesheet may have a rule that targets only the front end. When a value appears correct in one context but not the other, first verify that both contexts load the same generated property and then check selector scope and specificity.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Using standard style properties also matters for user customization. Values placed in the appropriate styles location can be adjusted through Appearance > Editor > Styles, whereas a free-form selector rule in an external stylesheet is not automatically exposed as an editor control.

Naming and organization practices

Use semantic names

Name a token for its role or scale, such as lineHeight.md, contentWidth.narrow, or contentWidth.wide. Names such as blueText or mobileMargin couple the variable to one use and make later changes harder.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep nesting shallow

Nested keys are useful for scales, but every level becomes part of the public variable name. A short, predictable path is easier to type in CSS and easier to audit in browser developer tools.

Keep slugs stable

Preset slugs and custom key paths are consumed by your style definitions and stylesheets. Renaming one is a coordinated change: update every var:custom|..., var:preset|..., and var(--wp--...) reference that uses it.

Separate definition from application

Declare values under settings, apply supported properties under styles, and reserve stylesheet rules for selectors or features that the style tree cannot represent. This keeps the token inventory discoverable and reduces duplicated literals.

Common mistakes and fixes

Symptom Likely cause Fix
The variable is undefined in CSS. The generated name was guessed incorrectly. Rebuild the name from the key path: convert camelCase to kebab case and add one segment for each nested key.
A token in theme.json is ignored. Ordinary CSS syntax was used inside the JSON style value. Use var:custom|... or var:preset|... in theme.json. Reserve var(--wp--...) for stylesheets.
A color does not appear as a normal editor option. It was declared as a free-form custom value instead of a color preset. Register it in the appropriate preset collection with a name, slug, and value.
The front end has the value but the editor does not. A stylesheet selector is limited to front-end markup, or the editor has a competing rule. Check that the variable declaration loads in the editor, then inspect the consuming selector and specificity in the editor context.
A block ignores the global value. A block-level style or more specific selector overrides the global rule. Inspect the block rule under styles.blocks and the computed cascade before changing the token itself.
JSON validation fails after adding a token. Missing commas, mismatched braces, or a value placed outside the expected object. Validate the JSON structure, ensure settings, custom, and styles are correctly nested, and keep the schema declaration available for editor validation.
A refactor leaves old values in use. A key or slug was renamed without updating consumers. Search for the old var:... path and old --wp--... name, then update every reference.

Version and schema considerations

The complete example uses "version": 2, matching the documented example for these settings and references. The $schema value points to WordPress’s living theme.json schema: https://schemas.wp.org/trunk/theme.json. If you target a newer theme.json API version, check the living reference and the version-specific behavior before adapting the example; property support and editor behavior can evolve.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not infer support for an arbitrary property merely because a CSS custom property can hold its value. The variable-generation mechanism is broad, while the Site Editor exposes only the standard style features it understands. For unsupported features, define the token in settings.custom and consume it from appropriate CSS.

A practical review checklist

  • Is the value a free-form token, or does WordPress provide a matching preset collection?
  • Does every custom key produce the kebab-case name you expect?
  • Are nested groups shallow enough to keep the generated name readable?
  • Inside theme.json, are references written as var:custom|... or var:preset|...?
  • Inside CSS, are references written as var(--wp--custom--...) or var(--wp--preset--...)?
  • Is the value applied at the correct level: global styles, an element, or a block?
  • Would placing the property in the standard styles tree give users a useful Appearance > Editor > Styles control?
  • Have you checked both the Site Editor and the front end?
  • Have you inspected the computed cascade before changing a correctly generated token?
  • Will a renamed key or slug require updates to multiple consumers?

Bottom line

Put reusable, theme-specific values in settings.custom; let WordPress turn their key paths into --wp--custom--... variables. Register colors, typography scales, spacing, shadows, and other supported user-facing values as presets so they receive the --wp--preset--... namespace and Site Editor integration. Reference tokens with pipe syntax in theme.json and with normal CSS var() syntax in stylesheets. Defining the token once and applying it through the appropriate global, element, or block style keeps editor previews and front-end output on the same design system.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.