Ask the Bartender: Will It Become Easier To Create Block Patterns?

Do you know if WordPress FSE is working to make it easier to create block patterns? Templates and Parts need to just click a button to download them. But patterns are very manual, and you need to register all of them programmatically.
Thiago

You are not the first person to ask this question, and it is something that I have been mulling over for a while. With theme development quickly encroaching a point where it could almost exclusively be done via the site editor, it makes sense that block patterns follow along with their template counterparts.

The feature has not been given any sort of official green light. I am not aware of a specific ticket for it, but it seems like it will be a part of the natural evolution of themes and patterns. I encourage opening a new ticket via the Gutenberg GitHub directory.

Two core features need to precede it:

A standard folder for storing patterns in themes.

A way to save patterns in the database.

Fortunately, there are tickets for both of these. Last month, Gutenberg lead Matías Ventura opened a new issue for standardizing how themes are organized. WordPress 5.9 will see the introduction of /templates and /parts folders for templates and template parts, respectively. These will be the officially-supported locations in block themes.

That same ticket proposes future enhancements of a /styles folder for global style variations and /patterns for block patterns. Having a standard location for these things is vital because the exporter in the site editor needs to know where to put them in the exported ZIP file.

A side benefit of this feature is that theme authors would no longer be required to register their custom patterns via PHP. They could merely drop the files into their /patterns folders and move on. The format of this is nowhere near official at this point. There is an unmerged pull request that implements this by searching file headers.

The second piece of solving this issue is figuring out how to allow users to save patterns via the UI similarly to reusable blocks. This is a more complex issue. There are existing plugins that already do this, such as my own Block Pattern Builder, which sorely needs updating, and BlockMeister, a more robust solution. Reusable Blocks Extended even allows users to convert reusable blocks into patterns. So, there are already folks who are trying to solve the problem.

There are still questions about the implementation before it can be officially supported. Are saved patterns a subtype of wp_block, which is currently the post type for reusable blocks? Are they something separate? Then, the project must also decide whether it wants to allow custom pattern categories via a new taxonomy.

There are also other considerations before adding another feature into core, such as adding a design library for components in the global space.

We are not quite to the point where you want, but we are on the path. The /patterns folder alone would remove the code-writing requirement. If it lands in WordPress, you could copy and paste block HTML over. It is not the same as exporting them alongside templates, but I hope the platform arrives at that destination one day.