Attachments button not working, refreshes page instead
-
I was having trouble where the attachments button wouldn’t work. It would effectively just refresh the page. Seemed to be exactly the same symptoms as this issue except the solution didn’t work. Attachments.js wasn’t even loading for me before the javascript crashed. This was happening with Cera theme (like the link), but also Twenty-TwentyOne with almost zero plugins loaded.
I couldn’t tell what tinymce.min.js was doing (since it’s .min) but it seemed to be failing on the string “bp_docs_tiny_mce_init”, which is only found in some PHP file with a WordPress filter and as a function in bp-docs.js.
Turns out bp-docs.js wasn’t loading either. It was depending on ‘heartbeat’ which wasn’t loading and thus bp-docs.js wasn’t either.
All I had to do was remove ‘heartbeat’ from the dependency list and everything started working. I’m not sure what heartbeat is, but none of the installs on my local pc or WP Engine seem to have it. Or at least it’s not visible by view-source.
Anyway, I’m just throwing it out there in case it’s a bug or if someone else has the same issue.
Original Line in \wp-content\plugins\buddypress-docs\includes\component.php
wp_register_script( 'bp-docs-js', plugins_url( BP_DOCS_PLUGIN_SLUG . '/includes/js/bp-docs.js' ), array( 'jquery', 'editor', 'heartbeat' ) );
Edited
wp_register_script( 'bp-docs-js', plugins_url( BP_DOCS_PLUGIN_SLUG . '/includes/js/bp-docs.js' ), array( 'jquery', 'editor' ) );
Error I got in Javascript while the button wasn’t working
Uncaught (in promise) TypeError: Cannot read property 'apply' of undefined at tN.execCallback (tinymce.min.js?ver=49110-20201110:2) at yw (tinymce.min.js?ver=49110-20201110:2) at f.content_style.a (tinymce.min.js?ver=49110-20201110:2) at tinymce.min.js?ver=49110-20201110:2
- The topic ‘Attachments button not working, refreshes page instead’ is closed to new replies.