3

I've got a page that calls wp_editor in the front end. Since upgrading to 4.5, the Add Media button no longer does anything at all.

It works fine if you call it in the admin section. There's no word from WordPress on this yet, but I've seen this complaint in a bunch of plugins all experiencing the same issue.

Because it still works in the admin section, I'm assuming that a piece of JS that used to make it work throughout WP has been moved to only been called in the admin section, but I don't know where that would be.

Has anyone else encountered and solved this?

  • 1
    The jQuery version in v4.5 is the newest version. Aparently, there are certain functionality that is not supported anymore, and script using that particular function is now broken. That is AFAIK – Pieter Goosen Apr 19 '16 at 10:42
  • Yep, that's it - moving across the jquery files from a previous version has fixed it; now I need to come up with a better way of doing that in theme that doesn't involved overwriting something in the wp-includes folder. – SinisterBeard Apr 19 '16 at 10:51
  • Man, you are not new here "stopped working" is rarely something that is possible to answer..... what errors do you get? any other relevant info? – Mark Kaplun Apr 19 '16 at 11:07
  • @MarkKaplun - Literally no errors. It just does nothing. Pieter's right, it's the new version of jQuery that did it. Have fixed it with a plugin as per my answer. – SinisterBeard Apr 19 '16 at 11:23
0

I've fixed it by creating the following tiny plugin:

<?php 
    /*
    Plugin Name: Fix "Add Media" button in WordPress 4.5
    Plugin URI: twitter.com/ojeffery
    Description: The 4.5 update of WordPress changed to the most recent version of JQuery, which broke the Add Media button when you call wp_editor via the front end. This tiny plugin fixes it by reverting to the previous version of JQuery. This should be considered a temporary measure until WordPress fixes it properly, as using an older version of JQuery may cause other issues.
    Version: 1.0
    Author: Oli Jeffery
    Author URI: twitter.com/ojeffery
    */

    function pre_4_5_jquery () {
    // Load jQuery
            wp_deregister_script('jquery');
            wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"), false);
            wp_enqueue_script('jquery');
    }
    add_action('init', 'pre_4_5_jquery');

?>
  • this is not fixing, this is closing your eyes and hoping that you will not fall from the cliff ;). You can do it now, but the longer you will keep avoiding finding the real issue the harder it will become to maintain your sites as jquery plugins will assume current version, and wordpress plugins will assume jquery of the current WP version. – Mark Kaplun Apr 19 '16 at 12:44
  • From the description of the plugin "This should be considered a temporary measure until WordPress fixes it properly, as using an older version of JQuery may cause other issues." – SinisterBeard Apr 19 '16 at 13:07
  • WordPress is not going to "fix" anything. This is an intentional change in jQuery, and it is not being reverted. You need to fix your broken theme or plugin code which is causing this error. – Otto Jun 5 '16 at 15:35
  • Yes, I've realised this since. Still, it works as a stop gap till you've done that. – SinisterBeard Jun 6 '16 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.