2
Uncaught TypeError: b(...).not(...).filter(...).mediaelementplayer is not a function

I am getting this issue after wordpress latest update 4.9. I am using this library in my plugin to allow users to upload images using the wp media upload. It was working fine, but after the latest update it is returning the error as I mentioned above.

Martin Evans
  • 45,791
  • 17
  • 81
  • 97
Ravi Tpss
  • 31
  • 1
  • 1
  • 3
  • Hi, Welcome to SO! Please see https://stackoverflow.com/help/how-to-ask for advice on writing good questions :) Your question currently needs a bit more information to be answerable. – deiga Nov 17 '17 at 09:24
  • 1
    See https://wordpress.org/support/topic/updated-wordpress-media-library-blank-mediaelementplayer-is-not-defined/ – Seb Cooper Feb 06 '18 at 12:18

2 Answers2

16

By adding the following code in functions.php file, error should be resolved.

add_action('wp_enqueue_scripts', 'my_register_javascript', 100);

function my_register_javascript() {
  wp_register_script('mediaelement', plugins_url('wp-mediaelement.min.js', __FILE__), array('jquery'), '4.8.2', true);
  wp_enqueue_script('mediaelement');
}
ankita patel
  • 4,201
  • 1
  • 13
  • 28
user8994543
  • 161
  • 2
  • mediaelement is already registered in WordPress by default. So no need of this line wp_register_script('mediaelement', plugins_url('wp-mediaelement.min.js', __FILE__), array('jquery'), '4.8.2', true); – Burhan Nasir Jul 05 '18 at 06:32
5
  1. Does it appear on post/page edit?
  2. 'Add Media' button is not working?

If you answer 'yes' on both questions take a look if jQuery is not loaded twice, if so, load one only or implement JQuery.noConflict().

Ursu Alexandr
  • 308
  • 3
  • 8