Add Media has stopped working in the front end since 4.5 update

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 Answer
1

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');

?>

Leave a Comment