Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fixing the JS error in WP SEO.
diff --git a/content/plugins/wordpress-seo/js/wp-seo-metabox.js b/content/plugins/wordpress-seo/js/wp-seo-metabox.js
index ecbbf24..62a6a46 100644
--- a/content/plugins/wordpress-seo/js/wp-seo-metabox.js
+++ b/content/plugins/wordpress-seo/js/wp-seo-metabox.js
@@ -282,12 +282,12 @@ function yst_updateDesc() {
snippet.find('.desc span.content').html('');
yst_testFocusKw();
- if (tinyMCE.get('excerpt') !== null) {
+ if ( window.tinyMCE && tinyMCE.get('excerpt') !== null) {
desc = tinyMCE.get('excerpt').getContent();
desc = yst_clean(desc);
}
- if ( tinyMCE.get('content') !== null && desc.length === 0) {
+ if ( window.tinyMCE && tinyMCE.get('content') !== null && desc.length === 0) {
desc = tinyMCE.get('content').getContent();
desc = yst_clean(desc);
@@ -465,11 +465,11 @@ jQuery(document).ready(function () {
yst_updateSnippet();
// Adding events to content and excerpt
- if( tinyMCE.get( 'content' ) !== null ) {
+ if( window.tinyMCE && tinyMCE.get( 'content' ) !== null ) {
tinyMCE.get( 'content' ).on( 'blur', yst_updateDesc );
}
- if( tinyMCE.get( 'excerpt' ) !== null ) {
+ if( window.tinyMCE && tinyMCE.get( 'excerpt' ) !== null ) {
tinyMCE.get( 'excerpt' ).on( 'blur', yst_updateDesc );
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.