There is an error at my console showing Uncaught TypeError: Cannot read property 'secret' of null at a.wp.receiveEmbedMessage (wp-embed.min.js?x59911:1)
Is there a way to fix this?
Issue is with Wordpress wp-embed.js . Change following following code/
if ( ! ( data.secret || data.message || data.value ) ) {
to
if ( ! data || ! ( data.secret || data.message || data.value ) ) {
On line 32. It should solve the issue. Refrence : https://core.trac.wordpress.org/ticket/44832
The issue ticket (also linked by Webmatrix) suggests the following code for wp-embed.js (starting line 31).
if ( data && ! ( data.secret || data.message || data.value ) ) {
return;
}
But changing that won't matter, since the wp-embed.min.js file is the one actually used. - And since it's all on one line, it's a little harder to find the right place.
Search for the string d.secret||
to find the right part and then replace that condition check with if(d && !(d.secret||d.message||d.value))
.
I had the same issue and doing this fixed it for me, while webmatrix's code (minified) if ( !d||!(d.secret||d.message||d.value) )
didn't work for my problem.
This suggests that in my case data is in fact being passed, it just doesn't have the value that I want. Maybe there's also a problem of sometimes no data being passed at all in which case you should still add his !data ||
at the very beginning of my conditional, like so: if(!d||d && !(d.secret||d.message||d.value))
.
Note
However, note you shouldn't be editing core files usually - because it could vanish on the next update - in this situation though, the next update is very likely to contain the same or a better fix, so if it's overwritten it shouldn't matter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With