Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#47545 new defect (bug)

Getting undefined wp.media.frame.state() after click on featured image preview

Reported by: nlemsieh Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2.1
Component: Media Keywords: reporter-feedback
Focuses: javascript Cc:


In WP 5.x:

  • When I click on the featured image preview the wp.media.frame.state().get('selection') is undefined.
  • But, when I click on the "Replace image" button wp.media.frame.state().get('selection') returns the selected attachment object (which is the expected behaviour).

While in WP 4.x it returns correctly the attachment when I click on the featured image preview.

Change History (3)

#1 @afercia
2 years ago

  • Component changed from General to Media

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.

2 years ago

#3 @joemcgill
2 years ago

  • Keywords reporter-feedback added

I'm able to reproduce this and it looks to me like the frame state is getting destroyed once the featured image has been set and the modal is closed. @nlemsieh are you suggesting that the state should be recreated when the modal is reopened by clicking on the featured image in the sidebar?

Note: See TracTickets for help on using tickets.