- Open Figma and navigate to the Community tab
- Search for "WordPress Theme.json Export"
- Click "Install" to add the plugin to your Figma workspace
If you're installing the plugin manually:
- Download the latest plugin release or clone this repository and run
npm install && npm run build - In Figma, go to Menu > Plugins > Development > Import plugin from manifest
- Select the manifest.json file from the downloaded files
For the best results when using the WordPress Theme.json Exporter:
- Create a "Primitives" collection - This collection will be used as the base for your theme.json file.
- Organize your variables in a hierarchical structure - Use the slash (/) separator to create hierarchy in variable names (e.g., "color/primary/900").
- For responsive variables - Create a collection with exactly two modes named "Desktop" and "Mobile".
- For color modes - Create a "Color" collection with different modes for each color scheme.
- For spacing variables - Create a "Spacing" collection or include spacing variables in your "Primitives" collection.
- Create text styles for your typography - These will be exported as typography presets.
- Use meaningful names - Name your text styles descriptively (e.g., "Heading/H1", "Body/Regular").
- Bind text properties to variables when possible - The plugin will use variable references for bound properties.
- Organize color variables - Group related colors using hierarchical naming (e.g., "color/primary", "color/secondary").
- Use semantic naming - Name colors by their purpose rather than their appearance (e.g., "primary" instead of "blue").
- Create color modes - Use multiple modes in your Color collection for different themes (light/dark).
- Use descriptive naming - Include keywords like "spacing", "gap", "margin", "padding", or "size".
- Create fluid spacing - Use the pattern
MAX_MIN(e.g.,24_16) for responsive spacing values. - Organize hierarchically - Use forward slashes to create spacing scales (e.g., "spacing/small", "spacing/large").
- Open your Figma document with variables and text styles
- Go to Menu > Plugins > WordPress Theme.json Export > Export to theme.json
- In the plugin UI, you can:
- Choose to include typography presets (from text styles)
- Generate color presets with customizable selection (If adding/editing variables, you may need to close and reopen the plugin if color variables are msising)
- Generate spacing presets from spacing variables
- Upload an existing theme.json file to merge variables into it
- Preview the generated theme.json and additional style files
- Download all files as a zip package
- Resizable Interface: Drag the resize handle in the bottom-right corner to adjust the plugin window size for better workflow integration
- File Preview: View all generated files with proper formatting and syntax highlighting
- Copy Functionality: Copy individual file contents to clipboard with one click
- Multi-file Download: Automatic zip packaging when multiple files are generated
- Check "Generate typography presets from text styles"
- Converts all local text styles in your document to WordPress typography presets
- Automatically handles line height conversion and text decoration properties
- Check "Generate color presets from color variables"
- Click "Customize" to open the color selection modal
- Select specific colors from your collections
- Preview actual color values and organize by collection
- Use collection toggles for quick selection
- Check "Generate spacing presets from spacing variables"
- Automatically detects spacing-related variables
- Handles fluid spacing patterns and semantic naming
- Creates WordPress spacing presets for the block editor
If you want to merge Figma variables into an existing theme:
- Prepare your existing theme.json file
- In the plugin UI, locate the "Base theme.json" section
- Click "Choose File" and select your theme.json file
- The file name will appear when successfully loaded
- Click "Export Variables" to merge your Figma variables into the theme
- All existing theme settings will be preserved, with new variables added under settings.custom
- Extract the downloaded zip file
- Copy the
theme.jsonfile to the root of your WordPress theme - Copy the
stylesfolder (if present) to the root of your WordPress theme - Your theme now has access to all the design tokens from Figma
The generated files provide:
- Custom variables under
settings.customfor use in CSS - Typography presets available in the block editor's typography controls
- Color presets available in the block editor's color picker
- Spacing presets available in the block editor's spacing controls
- Style variations for sections and buttons (if applicable)
The plugin automatically creates typography presets from your Figma text styles, with:
- Font family, size, weight, and line height properties
- Line height values converted from percentages (120%) to decimals (1.2)
- Proper text decoration handling for color, style, thickness, and offset
For responsive variables (using Desktop and Mobile modes):
- Values are exported as fluid variables with min and max values
- The
fluidproperty is set as"true"(string) for WordPress compatibility
For color collections with multiple modes:
- Each mode is exported as a separate section file
- Files can be used for WordPress theme variations or block styles
Button styles in your color collection are automatically:
- Extracted into separate style files
- Formatted for use as WordPress block styles
If you encounter issues:
- Variables not exporting - Make sure your variables are published and visible in the Variables panel.
- Text styles not appearing - Check that your text styles are local to the document.
- Missing typography properties - Some properties may be omitted if they contain invalid values.
- Base theme not loading - Ensure your theme.json file is valid JSON and follows the WordPress theme.json schema.
For more help, please refer to the README.md file or open an issue on GitHub.