Why Create Variations?
Most users don’t need to understand technical query concepts. A pre-configured variation provides:- Clear, branded block names and descriptions
- Sensible defaults for your post type
- Focused settings without irrelevant options
- Better discoverability in the block inserter
Creating a Basic Variation
Here’s a complete example for a “Books List” variation:Key Properties
namespace Attribute
Thenamespace attribute identifies your variation:
isActive Property
Define when your variation is considered active:scope Property
Setscope: [ 'inserter' ] to make your variation appear in the block inserter:
Defining the Layout
Using innerBlocks
Provide default inner blocks to skip the setup phase:Using Patterns
Alternatively, register patterns connected to your variation:Controlling Available Settings
allowedControls Property
Limit which settings users can modify:inherit- Allow inheriting query from templatepostType- Post type selectororder- Sort order (asc/desc)sticky- Sticky posts handlingtaxQuery- Taxonomy filters (inclusion and exclusion)author- Filter by authorsearch- Keyword searchformat- Post format filterparents- Parent entity filter
Adding Custom Controls
Use a block filter to add custom inspector controls:Custom Query Parameters
Add custom parameters to the query object:Front-End Implementation
Handle custom parameters with thequery_loop_block_query_vars filter:
Editor Preview
Handle custom parameters in the REST API for editor previews:Understanding taxQuery
ThetaxQuery attribute supports both inclusion and exclusion:
taxQuery is in allowedControls.