Here’s a way that could be “best” depending on the circumstance:
const { meta } = wp.data.select( 'core' ).getEntityRecord( 'postType', 'post', 123 );
This tutorial might be helpful for related stuff.
Related Posts:
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- How to save a ToggleControl value in a meta field?
- Custom Meta Box not Saving in Posts with Gutenberg Editor
- Looping inside block return
- Update post meta custom field using block editor
- WordPress Blocks, setAttributes not saving
- Can’t set custom meta fields for a post
- Custom meta POST request fired twice when updating a post in Gutenberg
- Block Editor – Meta values not saved, meta changes to empty array on update
- Custom post meta field effect on the performance on the post
- Difference between meta keys with _ and without _ [duplicate]
- Orderby meta_value only returns posts that have existing meta_key
- What is “meta_input” parameter in wp_insert_post() used for?
- How to enable revisions for post meta data?
- Can I count the number of users matching a value in a multiple value key?
- Auto sort the wp-admin post list by a meta key
- extend Meta Box / Document Panel
- Is there a hook / action that is triggered when adding or removing a post thumbnail?
- getEntityRecord without knowing the post type
- passing argument to get_template_part() or a better way to code
- Get updated meta data after save_post hook
- Create meta boxes that don’t show in custom fields
- Ordering posts by anniversary using only day and month
- How to break meta values into different items and avoid duplicates?
- ajax delete value from custom field array
- How to use pagination with get_post_meta
- Copying Custom Meta Values from existing post to a duplicate post
- Move value of one custom field to another
- Displaying posts with only upcoming dates according their custom field date value
- Custom fields: In what order are they saved into the DB?
- Get a post_id where meta_value equals something in a serialized meta_value field
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How to display Meta Field Value?
- MySQL query to set wp_postmeta using term_taxonomy_id value
- How to Validate Post Meta type/extension (Video File Image File etc)
- How can I sort homepage by a meta value?
- How do I use wp_query for WordPress search?
- Nav Menu – Add class based on meta keys
- How to update a meta field of type array in Gutenberg
- How to wrap meta values seperated by comma in ? [closed]
- Bulk remove post meta
- How to create html block to display extra information on woocommerce single product page
- Create Multiple File Upload Metabox in WordPress
- Run a check for multiple meta key values
- WordPress Rest API to call page data associate with custom meta
- Unsaved changes in metabox inputs not detected in the block editor
- Possible to add a meta field for css attribute to the editor Advanced panel?
- Add new image block, set default class name and update it using Javascript
- Hide custom meta data if empty
- How to create a shortcode to print specific values stored in a post meta array?
- Add custom field to all posts in specific post_type
- Button inside Custom Meta Box triggering the Update Button
- How to load an assets based on custom field value?
- Custom WP_Query for WordPress Search Results with meta_query
- How can you include custom post meta in search without calling each key?
- Can I access a post meta field before the loop?
- wrap text around custom fields array
- How can I modify RSS item titles to be either the title or a custom meta field?
- Avoiding ACF get_field and returning to core WordPress function
- Get all the posts where meta field with multiple choice has several values checked
- wordpress custom loop ascending descending posts by custom field
- Move Title and the Content WYSIWYG editor position
- Hide custom fields when empty
- How do i get the attached images with custom value checked?
- Save all the post tags inside a custom field
- How add multiple wp_editor_box to new post
- Get custom fields without _edit_last, _edit_lock, _wp_page_template and _visual-subtitle
- Display posts with empty custom field
- Get YouTube video id from url in a custom field
- Related query shows same image in loop
- Why am I getting a “Call to member function format() on a non-object” error?
- Can’t Output get_post_meta?
- Modify custom field from front end
- Footnotes in custom fields
- Create a new custom field for all posts based on current custom field
- wordpress get_post_meta / the_meta to output custom field value
- Custom Query: query by post custom meta data
- get_post_custom_values problem, please help
- how to enable custom fields in the Gutenberg post editor
- update_post_meta not working well
- Custom meta fields and meta keys
- Making custom meta box required (with error message if not filled in) on Gutenberg
- Set class if a meta value is set within post archive
- How to add a post’s view count into the WordPress API response
- Saving Custom Field that includes Quotation marks
- Allow HTML in Custom Metabox area
- Custom field metabox not showing in back-end
- Query Multiple meta
- Query Posts based on custom field value
- Query postmeta values, and return multiple post_titles for common meta value
- When post is updated, custom metadata in text area field is overwritten
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- Custom Field: Display only if a specific key is selected outside the loop
- When editing a post with a custom meta box the values aren’t displaying correctly
- Hard Define Custom Field Value
- add_post_meta insert null value into Database
- Retrieving custom field as shortcode
- Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Saving multiple custom meta box fields