Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
➎ Get the url of the current featured image
const { select } = wp.data;
const { getMedia } = select( 'core' );
const { getEditedPostAttribute } = select( 'core/editor' );
const mediaId = getEditedPostAttribute('featured_media');
const mediaUrl = getMedia(mediaId).source_url;
console.log(mediaUrl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.