Custom fields in WordPress allow you to add custom metadata to WordPress posts and pages. For more details, you can check out our glossary entry on custom fields .
They've been around for a long time, and both developers and advanced WordPress users use them in different ways.
WordPress 6.5 introduces a new Block Linking API, which allows users to use custom fields and other dynamic data as attributes for individual blocks.
This will also allow developers to display dynamic data within standard core blocks programmatically. Here's a detailed look at the Block Binding API on Make WordPress Core.
For the more adventurous among you, here's a quick way to try it.
Simply edit a WordPress post and add these two custom fields:
mood
weather report
You can see below what it should look like.
Adding custom fields
Next, in the Block Editor Settings, switch to the Code Editor view.
To do this, click on the three-dot menu in the upper home owner database right corner of the screen and select “code editors”.
Opening the WordPress code editor
Next, in the content area, you need to add the following code to a text field, such as a Paragraph block:
You can now save your changes and preview your post and page.
From this page, you will be able to view the meta key values displayed in your block's code.