Kind of a silly breakthrough, but I seem to have finally nailed down how to access Post data inside a custom block with useSelect
. I'm not going to bother quoting the official docs, they're extensive but hard to follow. Instead, here's the chunk of code I wanted to document and remember, it exposes the full Post object to the Block Editor:
const post = useSelect(
(select) => select("core").getEntityRecord("postType", postType, postId),
[postId]
);
Let's walk through that, outside-in: