Skip to content

Commit

Permalink
Use getPostMetaFields in canUserEditValue
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Sep 25, 2024
1 parent 09a88ff commit d190d3f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions packages/editor/src/bindings/post-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,9 @@ export default {
return false;
}

// Check that the custom field is not protected and available in the REST API.
const fieldValue = getPostMetaFields( registry, context )?.[ args.key ]
?.value;
// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.
const fieldValue = registry
.select( coreDataStore )
.getEntityRecord( 'postType', postType, context?.postId )?.meta?.[
args.key
];

if ( fieldValue === undefined ) {
return false;
}
Expand Down

0 comments on commit d190d3f

Please sign in to comment.