Created
December 12, 2018 13:34
-
-
Save robwent/3cd0726388dfb6071066c4e0f433632c to your computer and use it in GitHub Desktop.
WordPress 5 WP Ultimate Recipe Fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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