Created
January 11, 2019 08:10
-
-
Save httpstersk/994ba38fb075b07d55a45c3e56ae9553 to your computer and use it in GitHub Desktop.
➎ Get the url of the current featured image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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