xwp / unsplash-wp

GNU General Public License v2.0
9 stars 3 forks source link

Fix MediaUpload override issue #200

Closed ravichdev closed 4 years ago

ravichdev commented 4 years ago

Summary

Fixes #198

Checklist

ravichdev commented 4 years ago

@derekherman This is a tricky issue, Jetpack's filter on MediaUpload is at priority 11 and AMP's filter is at priority 10. Because of the way Jetpack's filter uses a HOC to return a new wrapped component, there is no way we can keep our custom extended component if we add our filter with a priority greater than 11. Priority less than 10 would result in AMP plugin overwriting our component.

This fix enqueue the featured image script to load after the AMPs script with filter priority 10 so the filter sequence would be AMP -> Our Component -> Jetpack, but this is kind of a hack and not a viable long term solution. I will open an issue on the Jetpack repo suggesting the Jetpack filter to increase the priority to a big number like 100.

postphotos commented 4 years ago

Tested locally, works for me! Thanks for this.

I will open an issue on the Jetpack repo suggesting the Jetpack filter to increase the priority to a big number like 100.

Please cc me on the ticket when you open this @ravichdev.