WordPress 6.5 introduces a new method of registering custom block variations using PHP instead of JavaScript, making it easier for plugin and theme authors. The new method adds a 'get_block_type_variations' filter hook that allows developers to inject custom variations from a plugin or theme. The post provides a step-by-step guide on how to register block variations with PHP and highlights the basic arguments that can be defined for a variation. It also mentions the limitations of registering variations with PHP compared to JavaScript.
Table of contents
Block variations hook and callbackBuilding a custom variationCustomizing the variation argumentsA future API?2 Comments
Sort: