wp.media undefined using Wordpress Media Uploader wp.media undefined using Wordpress Media Uploader wordpress wordpress

wp.media undefined using Wordpress Media Uploader


Solved the problem, the problem was that wp_enqueue_media(); calls the scripts into the footer of the page. Because I was using a die() function somewhere, the scripts weren't loaded.


put the wp_enqueue_media function in your enqueue scripts function.

Example:

add_action('wp_enqueue_scripts', 'prince_load_scripts');function prince_load_scripts(){wp_enqueue_media();//Yor scripts goes here...}


I also had a similiar problem...The scripts didn't load on one specific page, especially the scripts wp-media, which lead to the error "wp.media is not defined"... all the solutions didn't work. It turned out the content on this page was too massive, my PHP Memory Limit was to low. Setting up MemoryLimit 256->512 worked for me...