Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.78k stars 894 forks source link

Yoast SEO javascript conflict disabling all editors #11861

Open mammalalien opened 5 years ago

mammalalien commented 5 years ago

Please give us a description of what happened.

Further to this issue: https://github.com/Yoast/wordpress-seo/issues/10978

I'm also seeing TypeError: t.locale_data['js-text-analysis'][''] is undefined in an up to date copy of Avada, with a child theme. It is preventing use of any editor including Avada's Fusion Builder or the default editor.

The full error message is: TypeError: t.locale_data['js-text-analysis'][''] is undefined[Learn More] wp-seo-post-scraper-930.min.js:1:115508 o https://mglife.com.au/wp-content/plugins/wordpress-seo/js/dist/wp-seo-post-scraper-930.min.js:1:115508 y https://mglife.com.au/wp-content/plugins/wordpress-seo/js/dist/wp-seo-post-scraper-930.min.js:1:190701 D https://mglife.com.au/wp-content/plugins/wordpress-seo/js/dist/wp-seo-post-scraper-930.min.js:1:192342 i https://mglife.com.au/wp-admin/load-scripts.php:2:27444 fireWith https://mglife.com.au/wp-admin/load-scripts.php:2:28213 ready https://mglife.com.au/wp-admin/load-scripts.php:2:30004 K https://mglife.com.au/wp-admin/load-scripts.php:2:30366

WordPress 5.0.1 (though the problem was first noticed on 4.9.8) Avada 5.7.2, with all patches. Yoast SEO 9.3 (free)

Have tried:

I use this combination of Avada and Yoast SEO in multiple instances with the same hosting provider and so far this is the only copy displaying the issue. A work around I have offered my client is to temporarily disable Yoast SEO while making page content updates but that is obviously not a long term solution. Happy to purchase a premium license if needed though from the comments above the issue seems to affect both the free and premium versions.

Please describe what you expected to happen and why.

Content editors should load normally with no errors in JS console.

How can we reproduce this behavior?

  1. I've yet to identify a triggering factor but could provide access to the site experiencing the issue?

Technical info

Used versions

BerziOnline commented 5 years ago

Exactly the same problem here, with same versions, Avada Child Theme and tried workarounds. I did the same tests and nothing helped for me, too.

If anyone of the Yoast Support needs temporary access, I could offer it.

moorscode commented 5 years ago

Hi @mammalalien, @BerziOnline

We're sorry you are having problems with your sites, thank you for creating this report so we can try to figure out what is happening.

One of the things standing out in your report is the following:

I use this combination of Avada and Yoast SEO in multiple instances with the same hosting provider and so far this is the only copy displaying the issue. Are there any settings that are different on this specific site, like language or user roles?

Technical analysis: The locale_data['js-text-analysis'][''] is a holder of translation strings which will be used to display texts in the language that is being configured for the current user. These are being loaded via PHP and passed to JavaScript using WordPress functions.

It seems that there is something preventing this data to be loaded properly.

A helpful tool to determine what might be the cause is Query Monitor, a free plugin by John Blackbourn - this will add a bar into the admin bar which provides information about what "assets" are loaded and where problems occur.

Would it be possible for you to install this plugin and see if there are any errors or warnings coming from it?

mammalalien commented 5 years ago

Hi @moorscode,

I'm pretty sure all of the sites I've built so far are the Australian English version or WordPress. This one certainly is.

User roles available are just the WordPress defaults and those created by Yoast SEO and WooCommerce:

Installed Query Monitor and got one warning for a Slow Query when viewing a page editor page that was effected by the issue described: Query: SELECT DISTINCT meta_key FROM wp_postmeta WHERE metakey NOT BETWEEN '' AND '_z' HAVING metakey NOT LIKE '\%' ORDER BY meta_key LIMIT 30 |  

Caller: do_meta_boxes() wp-admin/includes/template.php:1215 post_custom_meta_box() wp-admin/includes/meta-boxes.php:685 meta_form() wp-admin/includes/template.php:630

When viewing the front end of the site I get one PHP Error noted in Query Monitor: Message: Use of undefined constant JSON_UNESCAPED_SLASHES - assumed 'JSON_UNESCAPED_SLASHES'

Location:

get_header() wp-content/themes/Avada/100-width.php:15 locate_template() wp-includes/general-template.php:41 load_template('wp-content/themes/Avada/header.php') wp-includes/template.php:647 wp_head() wp-content/themes/Avada/header.php:21 do_action('wp_head') wp-includes/general-template.php:2614 WPSEO_Frontend->head() wp-includes/class-wp-hook.php:286 do_action('wpseo_head') wp-content/plugins/wordpress-seo/frontend/class-frontend.php:659 WPSEO_JSON_LD->json_ld() wp-includes/class-wp-hook.php:286 do_action('wpseo_json_ld') wp-content/plugins/wordpress-seo/frontend/class-json-ld.php:41 WPSEO_JSON_LD->website() wp-includes/class-wp-hook.php:286 WPSEO_JSON_LD->output() wp-content/plugins/wordpress-seo/frontend/class-json-ld.php:94 WPSEO_JSON_LD->format_data() wp-content/plugins/wordpress-seo/frontend/class-json-ld.php:163 wp-content/plugins/wordpress-seo/frontend/class-json-ld.php:180

Component: Plugin: wordpress-seo

Does that help at all? Please let me know if I can do anything else to help diagnose the issue.

BerziOnline commented 5 years ago

Are there any news about this problem? I have still the same behavior and cannot use the fusion builder during the activated yoast plugin. :-/ I think also that there must be a problem since WordPress 5 with the compatibilty between these plugins, because I have another page which is not updated to WordPress 5 with Yoast and Avada Fusion Builder where no problems happen. I cannot upgrade just for testing, because this is an important live page environment. The only difference is the WordPress Version. They are also on the same server.

moorscode commented 5 years ago

The message Use of undefined constant JSON_UNESCAPED_SLASHES - assumed 'JSON_UNESCAPED_SLASHES' is something I would not expect.

Could you provide details about the PHP Version the server is using?

BerziOnline commented 5 years ago
Server Info: [?] Apache/2.4.25 (Debian)
PHP Version: [?] 7.2.13
PHP Post Max Size: [?] 256 MB
PHP Time Limit: [?] 300
PHP Max Input Vars: [?] 3000
SUHOSIN installiert: [?]
ZipArchive: [?]
MySQL Version: [?] 5.5.5
Max Upload Größe [?] 256 MB
DOMDocument: [?]
WP Remote Get: [?]
WP Remote Post: [?]
GD Library: [?] 2.2.4

I've also sent you an Mail to gain access to the backend including the QueryMonitor. Just tell me if I should send you the credentials again.

mammalalien commented 5 years ago

Thanks @moorscode, PHP version is 7.1.26. For further details see the screenshot. I'd be happy to provide any other specifics that may help. screen shot 2019-01-21 at 10 11 48 am

roryroryrory commented 5 years ago

I have this exact same problem. Are there any updates or fixes available? Basically any editor is disabled within the Avada theme when Yoast is active. The problem started with forced migration to Gutenberg, but still persists under Classic editor. I've disabled every plugin in turn, and yoast is clearly the culprit. I would like to continue using Yoast, but having to deactivate the plugin every time an edit is needed is time consuming and increasingly unnecessary.

mammalalien commented 5 years ago

@moorscode has any progress been made on this?

Please provide any further instruction that may aid in diagnosing the issue.

mammalalien commented 5 years ago

Some further information: I noticed that the inner content of the Yoast SEO panel on an edit screen was also not loading, indicating that it is something to do with that panel's initialisation which is blocking the editors from loading.

As a workaround, you can visit (your site)/wp-admin/admin.php?page=wpseo_titles#top#post-types and disable the Yoast SEO meta box switch for a given post type (including pages). This way you can at least get your editors back.

It does mean you won't be able to customise the search description and SEO title for posts under that post type, but does allow you to make content updates without deactivating the plugin.

roryroryrory commented 5 years ago

Many thanks for the help @mammalalien. I've tried disabling the Yoast SEO meta box (across the board) and I still don't have access to any of my editors with the Yoast plugin enabled. Is there anything else I can check?

mammalalien commented 5 years ago

@roryroryrory Sorry, that's all I've managed to figure out so far. I only disabled the Yoast SEO meta box for Pages and it was enough to get editors back in that one case.

mammalalien commented 5 years ago

Think I might have cracked it, I went back and re-read @moorscode 's comments above and noted that the js file causing the problem related to translations. I have this site (like most of mine) running in Australian English (like British English but with more swearing and pejoratives).

Summary for the lazy: Change back to English (United States) under Settings > General.

Long version: As a test, I turned the Yoast SEO meta box back on for pages to ensure the problem still existed. Sure enough, no editors. This was just undoing an earlier workaround.

Then, I set the site language to the default English (United States) under /wp-admin/options-general.php and reloaded a page-edit screen. Sure enough, Fusion Builder and the Yoast SEO meta box both loaded normally. I toggled back and forth between US ans AU English a few times and the editors were always broken in Australian English but fine in US.

Leaving the site in US English I jumped into my FTP program of choice and removed all of the …_AU.po and …_AU.mo translation files from /wp-content/languages/ and the …/plugins/ and …/themes/ sub-folders therein.

Toggling back to Australian English at this point, WordPress reinstalled the core translation files but not the ones for plugins and themes. Still no editors.

Noting that plugin translations hadn't been re-installed I applied the latest update for Yoast SEO (9.6). This prompted re-installation of translations for all plugins, but not themes.

Now, with the site language set to Australian English, editors load up just fine (woo!) but the Yoast SEO meta box is still broken and the same error appears in the Javascript console: TypeError: t.locale_data['js-text-analysis'][''] is undefined.

Any further thoughts @moorscode ? For us English speakers it is no problem to simply change back to US English but this solution doens't help people who only understand languages other than English.

BerziOnline commented 5 years ago

@mammalalien Thanks for your workarounds. The workaround of deactivating the meta boxes on the post types helped for me. But changing the language from German to English (United States) didn't help with that.

roryroryrory commented 5 years ago

@mammalalien thanks so much for the work you're putting into finding a solution. I have my site running in English (United States), and I'm still encountering this issue with editors. However, your comments on it being a translation issue are making me wonder whether it could be related to a conflict with translation plugins such as WPML. I'm not sure whether the others facing this problem have a translated version of their website, but the CMS and string translation properties of these plugins could potentially create some conflict with Yoast. I never had this issue with Yoast and WPML prior to the Gutenberg release, so I'm not sure if this explains things. Would appreciate your thoughts, and again many thanks for the help Peter.

mammalalien commented 5 years ago

@BerziOnline Interesting that it didn't work in your case. I have tried quite a few things before as well that may have worked in combination with switching language. Did you try clearing out the language files? If you do, remember to make a backup. They should be reinstalled on the fly but a quick backup can save you hours of pain later.

@roryroryrory You're welcome! The problem needs solving, I just wish I understood it better. The error in the JS console looks similar to what happens when you try and refer to part of a PHP object that doesn't exist. I'm guessing some piece of translation data isn't being loaded and the Yoast meta box isn't coded to handle that occurrence by defaulting to US English or something?

Really need some more input from the authors.

As a test, I changed to English (UK) and am getting the same result as with my re-installed Australian English: Editors but broken Yoast meta box, FYI.

BerziOnline commented 5 years ago

At the moment I am working with the deactivated meta boxes, so the fusion builder is usable. Everytime I have edited a page I activate the meta box temporarily to edit the SEO meta tags afterwards. But now I had to find out, that it just works for the "pages" and not for the "posts".

In both cases, of course, still the editor crashes and it's not shown. (the main problem from the beginning on) But when I reactivate the meta box for pages at least the yoast meta box works fine. On posts the meta box is also empty now! Even if I deactivate the fusion builder itself :/ So on posts I am not able to use the yoast meta settings anymore :/

It looks like this: (the fusion builder is crashed and not shown, but for now it's about the empty Yoast-box)

yoast-crash2

mammalalien commented 5 years ago

@BerziOnline Yes, I've seen that empty Yoast metabox too, but on pages.

I see @Djennez has now tagged this with "Bug" and "Needs-Investigation". Hopefully we'll get some action on it from the developers in the near future.

BerziOnline commented 5 years ago

Just wanted to update, that it was an individual problem of one of my pages: We had old optimizations of filter for async javascript in the functions.php and it lead to the problem. To solve the problem we avoided it for the admin kind like:

if( !is_admin() ){ ... }

Just wanted to be fair to mention, that it was not a problem of Yoast or the FusionBuilder of Avada themselves and maybe it helps for anyone.

mammalalien commented 5 years ago

Thanks @BerziOnline, that's good to hear. I was still having the issue even with the child theme disabled (no custom functions.php) but I could look into that when I get the chance.

fabiomela commented 5 years ago

Hi All,

do you have any update about this issue? I've the same issue. My configuration: WP: 5.1.1 Yoast SEO: 10.0.1 [free] Theme: Proficia 1.0.8 (not related to the issue)

Do you have any suggestion?

The image of the issue:

Schermata 2019-03-27 alle 17 09 19
Djennez commented 5 years ago

The blank metabox is caused by javascript errors. So far, these instances are or were caused by conflicting plugins and / or themes. If you experience this issue, please make sure you disable all plugins except Yoast, clear your cache and see if that solves the issue. If so, start enabling plugins one by one to find the culprit. The following plugins / themes are known to me to cause this:

OneSignal plugin (fixed in the latest version, make sure to clear your cache after updating) Prophoto6 theme WP Log Viewer plugin

If you run any of these, try disabling them and clearing your cache to see if that solves the issue.

fabiomela commented 5 years ago

Thank you for your reply. I've deactivated all my plugins, cleared the cache, but the issue remains. Which kind of check may i've to do for helping spot the bug?

Schermata 2019-03-29 alle 15 15 09 Schermata 2019-03-29 alle 15 16 05
mammalalien commented 5 years ago

Thanks @Djennez,

yes, I tried deactivating all plugins some months ago. The conflict appeared to be with Avada's Fusion Builder Core which is a critical plugin.

Note: I have Yoast and Avada running together with no issue on at least a dozen sites. Evidently there is something different about this one. Perhaps a different setting somewhere that I've not thought to check.

miklosq commented 5 years ago

All, I have experienced the exact same issue. My environment is:

I have a workaround for this issue, it's a one-line fix, only for temporary use. It works for me, please apply it only at your own discretion. I do not take any responsibility for any damages it might cause. You have been warned.

if (defined('JSON_UNESCAPED_SLASHES')) {
        $flags = ( $flags | JSON_UNESCAPED_SLASHES );
}

Kind regards, qmi

corneels commented 3 years ago

I am also experiencing this same issue.

The moment I disable Yoast, my Avada Live Editor is working again. When I enable Yoast, it stops working.

When I change my language to US English, the problem goes away.