Make WordPress Core

Opened 6 years ago

Closed 2 years ago

#42750 closed defect (bug) (worksforme)

Javascript breaks in some backend pages

Reported by: viajarapie's profile viajarapie Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9
Component: General Keywords: close
Focuses: javascript Cc:

Description (last modified by johnbillion)

As discussed in ticket #42574, there seems to be at least one further reason why javascript stops working on some backend pages other than the already identified and corrected about the language codes.

Please refer to entry #24 in said ticket #42574 where the problem is described by some other user. According to this description javascript stops working when jquery is loaded twice. I don't know javascript at all and I can't identify where jquery is loaded from but I checked the source for different pages on my backend with consistent results: every time a backend page doesn't work well (like sreen options or help menus not being deployed, post tags not being assignable and other malfunctions), I see jquery being loaded twice in the page source. Every time a backend page shows no problems, there's only one load of jquery in the page source. The correlation seems clear.

I enclose source excerpts from two different pages, Post Editor and Image Editor where the double loading of jquery is shown. I think it's the very same source for both cases.

In pages that work well there's only this jquery loading:

<script type="text/javascript">
		$('select[name^="action"] option:last-child').before('<option value="bulk_regenerate_thumbnails">Regenerate Thumbnails</option>');

Hope you can help and thanks in advance.

Attachments (2)

Post Editor Source.txt (5.9 KB) - added by viajarapie 6 years ago.
Post Editor Source excerpt
Image Editor Source.txt (5.9 KB) - added by viajarapie 6 years ago.
Image Editor Source excerpt

Download all attachments as: .zip

Change History (15)

6 years ago

Post Editor Source excerpt

6 years ago

Image Editor Source excerpt

#1 follow-up: @johnbillion
6 years ago

  • Description modified (diff)
  • Focuses javascript added
  • Keywords reporter-feedback added

Thanks for the report.

Are you able to deactivate all the plugins on your site to see if the problem persists? If so, can you try switching to one of the default themes (such as Twenty Seventeen) and see again if the problem persists?

Failing that, are there any JavaScript errors showing in your web browser developer tools console?

#2 in reply to: ↑ 1 @viajarapie
6 years ago

I only have the live site, I'd rather avoid deactivating anything.

There are indeed errors in the console. For example, in the Post Editor I get this right after loading the page:

mediaelement-and-player.min.js?ver=4.2.6-78496d1:12 Uncaught TypeError: Language code must have format 2-3 letters and. optionally, hyphen, underscore followed by 2 more letters

at Object.s.language (mediaelement-and-player.min.js?ver=4.2.6-78496d1:12)
at Object.o.5.15 (mediaelement-and-player.min.js?ver=4.2.6-78496d1:12)
at i (mediaelement-and-player.min.js?ver=4.2.6-78496d1:12)
at e (mediaelement-and-player.min.js?ver=4.2.6-78496d1:12)
at mediaelement-and-player.min.js?ver=4.2.6-78496d1:12

mediaelement-migrate.min.js:1 Uncaught ReferenceError: MediaElementPlayer is not defined

at mediaelement-migrate.min.js:1
at mediaelement-migrate.min.js:1

wp-mediaelement.min.js?ver=4.9.1:1 Uncaught TypeError: b(...).not(...).filter(...).mediaelementplayer is not a function

at HTMLDocument.a (wp-mediaelement.min.js?ver=4.9.1:1)
at i (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:2)
at Object.fireWith [as resolveWith] (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:2)
at Function.ready (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:2)
at HTMLDocument.K (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:2)

Then a while later I get this other:

load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,jquery-ui-position,wp-pointer,thickbox,shortcode,media-upload,heartbeat,autosave,jquery-query,admin&load[]=-comments,postbox,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box,word-count,post,editor-expand,media-editor&load[]=,media-audiovideo,mce-view,imgareaselect,image-edit,svg-painter,wp-auth-check,jquery-ui-draggable,jquery-ui-slider,jquery-touch-&load[]=punch,iris,wp-color-picker,editor,wplink,wp-embed&ver=4.9.1:647 Uncaught TypeError: Cannot read property 'hasClass' of undefined

at HTMLDocument.<anonymous> (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,jquery-ui-position,wp-pointer,thickbox,shortcode,media-upload,heartbeat,autosave,jquery-query,admin&load[]=-comments,postbox,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box,word-count,post,editor-expand,media-editor&load[]=,media-audiovideo,mce-view,imgareaselect,image-edit,svg-painter,wp-auth-check,jquery-ui-draggable,jquery-ui-slider,jquery-touch-&load[]=punch,iris,wp-color-picker,editor,wplink,wp-embed&ver=4.9.1:647)
at HTMLDocument.dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:3)
at HTMLDocument.r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:3)
at Object.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:3)
at Object.a.event.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:9)
at HTMLDocument.<anonymous> (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:3)
at Function.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:2)
at a.fn.init.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:2)
at a.fn.init.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-widget,quicktags,underscore,wp-ajax-response,jquery-color,wp-lists,suggest,jquery-ui-&load[]=core,jquery-ui-mouse,jquery-ui-sortable,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload&ver=4.9.1:3)
at Object.<anonymous> (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,jquery-ui-position,wp-pointer,thickbox,shortcode,media-upload,heartbeat,autosave,jquery-query,admin&load[]=-comments,postbox,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box,word-count,post,editor-expand,media-editor&load[]=,media-audiovideo,mce-view,imgareaselect,image-edit,svg-painter,wp-auth-check,jquery-ui-draggable,jquery-ui-slider,jquery-touch-&load[]=punch,iris,wp-color-picker,editor,wplink,wp-embed&ver=4.9.1:357)

This one repeats periodically.

I'm now running WP4.9.1

#3 follow-up: @adamsilverstein
6 years ago

@viajarapie can you provide some more details about your setup? What language is the front/back end set to? can you provide a list of plugins and your active theme? Thanks.

#4 in reply to: ↑ 3 ; follow-up: @viajarapie
6 years ago

@adamsilverstein I have a WP 4.9.1 installation in Spanish and a Polylang installation with es_ES and en_GB configured.

My active theme is Lovecraft with a some customizations in a child.

Below is my list of active plugins. You will notice that several of them need an update, they were all downgraded by me to the version they had before I had the current problem so everything in my installation is back to the last working version except the WP installation itself.

All In One SEO Pack
There is a new version of All In One SEO Pack available. View version 2.4.3 details or update now.

Version 3.4.4

Better Search Replace
Version 1.3.1

Breadcrumbs Builder
Version 1.0.7

Code Snippets
Version 2.9.4

Content Anchor Links
Version 1.5

Custom Post Templates
Version 1.5

Easy Footnotes
Version 1.0.10
There is a new version of Easy Footnotes available. View version 1.0.11 details or update now.

Easy Google Fonts
Version 1.4.3

Email Subscribers & Newsletters
Version 3.4.2
There is a new version of Email Subscribers & Newsletters available. View version 3.4.4 details or update now.

Grid Plus
Version 1.1.9

Instant Breadcrumbs
Version 1.4.5

Jetpack by
Version 5.5
There is a new version of Jetpack by available. View version 5.5.1 details or update now.

List category posts
Version 0.72
There is a new version of List category posts available. View version 0.74.2 details or update now.

Media Library Assistant
Version 2.62
There is a new version of Media Library Assistant available. View version 2.65 details or update now.

Menu Items Visibility Control
Version 0.3.5

Modify Attachments Meta
Version 0.2

Organize Series
Version 2.5.7

Version 5.1

Version 2.2.6
There is a new version of Polylang available. View version 2.2.7 details or update now.

Post Tags and Categories for Pages
Version 1.4.1

Recent Posts Widget With Thumbnails
Version 5.2

Regenerate Thumbnails
Version 2.3.1

Simple Image Sizes
Version 3.1.1

Version 1.8.1

Theme and plugin translation for Polylang (TTfP)
Version 2.0.1

Ultimate Post List Pro
Version 9.1

Ultimate Responsive Image Slider
Version 3.1.0
There is a new version of Ultimate Responsive Image Slider available. View version 3.1.3 details or update now.

Widgets Control
Version 2.0.3

Wordfence Security
Version 6.3.21

WordPress Importer
Version 0.6.3

WP Downgrade | Specific Core Version
Version 1.1.4

WP Rollback
Version 1.5

Thanks for taking care. At the moment, my site fronted works fine but the backend doesn't to the point that I can't post new entries (Add Object doesn't work, HTML view doesn't work, tag setting doesn't work either). I hope you can find what happens. Anything else you might need from me, I'll be happy to help.

#5 in reply to: ↑ 4 ; follow-up: @viajarapie
6 years ago

Let me add that despite being a live site I could deactivate plugins temporarily but please let me know: If I deactivate/reactivate a plugin, does it come back to normal? Does it keep all settings? Will everything work just the same as it did before deactivation? Does it depend on each particular plugin? Some of them are so central to the site that losing any configuration could be catastrophic.

#6 in reply to: ↑ 5 ; follow-up: @knutsp
6 years ago

Replying to viajarapie:

Let me add that despite being a live site I could deactivate plugins temporarily but please let me know: If I deactivate/reactivate a plugin, does it come back to normal? Does it keep all settings? Will everything work just the same as it did before deactivation?

Simply, yes. Deactivated plugins can do nothing to the settings, simply because it's not active (the code not loaded). When reactivated they usually don't see/know that it has been deactivated, if no special tracking of that is implemented.

You van also rename the plugins folder temporarily.

Deleting a plugin form the admin means uninstall, that depending on the plugin and it's settings, settings or data may disappear.

Having a backup of the database is always wise. All settings are usually in the database.

#7 in reply to: ↑ 6 ; follow-up: @viajarapie
6 years ago

@knutsp I deactivated all plugins, cleared the browser cache, then reactivated one by one. I tried loading the Post Editor each time. Here is the report:

With all plugins deactivated, I recovered part of the missing functionality but not all. The HTML view was still not working. I could not add media. On the other hand, the Screen Options and the Help buttons were working again. I could assign Tags. When scrolling down, the Add Media button and all the edition buttons would stay on top of the page (previously they would all scroll up).

When re-activating plugins, everything stayed as described in the paragraph above except for 2 plugins:

Media Library Assistant

Re-activating any of those 2 plugins would mean the Post Editor had all the problems described above and the issues that had been corrected reappeared: Screen Options and Help buttons didn't work, the Tag assignment didn't work either and all the header panels (edition buttons et al) would scroll up.

The browser console would show the same errors described in my reply # 2 above, even with all plugins deactivated.

My uninformed summary is there's three suspects:

Media Library Assistant

Everything was working well with WP 4.8.3

Right now, my frontend works well, as far as I've noticed. It's my backend that has problems but it's rather serious as I cannot post new content.

I will consider downgrading WP to 4.8.3 so I can keep working with the site. I don't dare to change the Theme as the theme developer told me I could miss settings that would be hard work to recover.

I welcome your help. Hope you can find out what the problem is. Thanks a lot for your work!

#8 in reply to: ↑ 7 @viajarapie
5 years ago

Latest update: I downgraded WP to 4.8.3. My backend works fine now.

I also deactivated WP automatic updates. I'll use 4.8.3 until the problem is found.

Anything you need from me, please let me know. Thanks!

#9 @adamsilverstein
5 years ago

  • Keywords close added; reporter-feedback removed

@viajarapie thanks for the update and your time reporting and testing this issue.

It does seem likely that something in the theme/child theme or plugins you mentioned is the issue. I was not able to reproduce the issues you mentioned with all plugins disabled locally, i tried the Lovecraft theme and I think the language settings you mentioned as well. You might want to check with your theme developer, maybe they can help you get this working correctly with 4.9.

This seems like an issue specific to your setup, marking to close.

#10 @viajarapie
5 years ago

Hi again,

The Theme developer delivered a new version (Lovecraft 1.19) even though the upgrade wasn't related to the javascript problem I experienced with WP 4.9 apparently.

I installed Lovecraft 1.19 while still running WP 4.8.3 and everything worked fine.

I have just upgraded to WP 4.9.1 and the javascript problem in my backend has come back, just as described in this thread above.

I have notified the Lovecraft theme developer in hopes he can help.

I will need to downgrade WP again to the last version that was working for my installation (4.8.3)

If you have any idea about what could be wrong, I welcome your help.

Thanks for your time!

#11 @viajarapie
5 years ago

FYI, the javascript problem seems fixed. I changed the language selection in my backend from "Espanol (Espana)" to "Espanol" and it did the trick. Bummer that I didn't try that earlier! more so when it was one of the main pieces of advice I got but the backend interface hides the code associated to the language selection and I wasn't aware the change would make a difference.

All seems fine now. Thanks for all the help.

#12 @bambambam
5 years ago

I use WordPress 4.9.6 and encounter similar symptoms:
media empty, customizr blank, widgets not editable...

javascript console:

SyntaxError: illegal character
ReferenceError: mejs is not defined
TypeError: b(...).not(...).filter(...).mediaelementplayer is not a function[Weitere Informationen]
TypeError: e is undefined

no polylang or other language plugins are used.
life site, so i did not disable all plugins.
test site runs same WP version, same plugins, no error, ui working fine.
did you find out anything about the media player error?

thank you in advance!

#13 @hellofromTonya
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I'll close this ticket as the original problem was resolved and was due to a theme and not WordPress Core.

Hello @bambambam, Does the problem continue to happen for your site today? If yes, please troubleshoot following the same steps above. You can open a Support ticket forums for additional assistance.

Note: See TracTickets for help on using tickets.