Created
March 14, 2015 04:03
-
-
Save peterwilsoncc/09308af2765897a8a5f7 to your computer and use it in GitHub Desktop.
Fixing the JS error in WP SEO.
This file contains 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
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