Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress 5 WP Ultimate Recipe Fix
function WpUltimateRecipeGutenbergEditorLoaded() {
return ( wp.data !== undefined && wp.data.select( 'core/editor' ) !== undefined );
}
// TODO WordPress 5.0 Gutenberg fix. Get rid once fixed in core.
if (WpUltimateRecipeGutenbergEditorLoaded() && window.tinymce) {
wp.data.subscribe(function () {
// the post is currently being saved && we have tinymce editors
if (wp.data.select( 'core/editor' ).isSavingPost() && window.tinymce.editors) {
for (var i = 0; i < tinymce.editors.length; i++) {
tinymce.editors[i].save();
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment