From edbc16d3d1e06d95046b08b4f98613e1d22522af Mon Sep 17 00:00:00 2001 From: Mario Santos Date: Wed, 28 Aug 2024 18:11:16 +0200 Subject: [PATCH] Contemplate empty strings and false values --- packages/editor/src/bindings/post-meta.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/bindings/post-meta.js b/packages/editor/src/bindings/post-meta.js index 87c06cc45e009a..a1575f2b4baba2 100644 --- a/packages/editor/src/bindings/post-meta.js +++ b/packages/editor/src/bindings/post-meta.js @@ -53,13 +53,14 @@ export default { } // Check that the custom field is not protected and available in the REST API. - const isFieldExposed = !! select( coreDataStore ).getEntityRecord( + // Empty string or `false` could be a valid value, so we need to check if the field value is undefined. + const fieldValue = select( coreDataStore ).getEntityRecord( 'postType', postType, context?.postId )?.meta?.[ args.key ]; - if ( ! isFieldExposed ) { + if ( fieldValue === undefined ) { return false; }