How do I get the current post ID within a Gutenberg/Block Editor block?
Question
I would like to access the current post ID from within a block. According to this documentation page, it seems like I should be able to get the post ID with:
wp.data.getCurrentPostId();
// or
wp.data.withSelect('core/editor').getCurrentPostId();
// or
wp.editor.getCurrentPostId();
but none of those are correct.
0
block-editor
4 years
2018-11-30T09:25:45-05:00
2018-11-30T09:25:45-05:00 0 Answers
96 views
0
Leave an answer