• Resolved Barry Ceelen

    (@barryceelen)


    The plugin seems to cause JavaScript errors when the media view related scripts have been removed, in my case when removing the media upload button via remove_action( 'media_buttons', 'media_buttons' ).

    A workaround might be to hook the plugin’s enqueue function into ‘wp_enqueue_media’ in stead of ‘admin_enqueue_scripts’. This hook is called at the end of the wp_enqueue_media() function generally used to enqueue all scripts and stuff for the media editor.

    • This topic was modified 7 years, 8 months ago by Barry Ceelen.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author leemon

    (@leemon)

    I’ll take a look into it, thanks!

    Thread Starter Barry Ceelen

    (@barryceelen)

    A quick and dirty fix for future reference:

    add_action( 'admin_enqueue_scripts', 'prefix_de_and_re_enqueue_default_media_uploader_view_script', 1 );
    
    function prefix_de_and_re_enqueue_default_media_uploader_view_script() {
    	
    	wp_dequeue_script( 'default-media-uploader-view' );
    	
    	add_action( 'wp_enqueue_media', array( 'DefaultMediaUploaderView', 'admin_enqueue_scripts', ) );
    }
    • This reply was modified 7 years, 8 months ago by Barry Ceelen.
    • This reply was modified 7 years, 8 months ago by Barry Ceelen.
    Thread Starter Barry Ceelen

    (@barryceelen)

    Thanks for the plugin update!

    Plugin Author leemon

    (@leemon)

    ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Creates JavaScript errors if media view has been removed’ is closed to new replies.