Skip to content

Instantly share code, notes, and snippets.

@robwent
Created December 12, 2018 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robwent/3cd0726388dfb6071066c4e0f433632c to your computer and use it in GitHub Desktop.
Save robwent/3cd0726388dfb6071066c4e0f433632c to your computer and use it in GitHub Desktop.
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