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

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