Support » Plugin: Jetpack by WordPress.com » "Add Media" Uploads broken with Jetpack activated

  • I’ve tracked down a bug with Jetpack, and have been able to patch my local version to solve this issue.

    The issue: When adding a new blog post or editting an existing blog post, using the “Add Media” button to upload a new attachment does not work. The drag-drop instructions are missing (even though I’m using the latest Chrome browser) and the “Select File” button does nothing when clicked.

    The cause: The pluploader is never instanciated, because the required javascript files are included in the head element, instead of the footer.

    The underlying code change which broke this: Around version 2.1, (specifically SVN revision 645298), Jetpack began registering a js file as ‘jetpack-gallery-settings’. A dependency of this javascript is ‘media-views’, and it is adding itself to the head element.

    The fix: By adding the fifth argument to wp_register_scripts as true, so that the wp_register_script call knows to add ‘jetpack-gallery-settings’ to the footer, ‘media-views’ (and its associated dependencies) is also properly added to the footer, and everything works again. It may not be required, but for tidyness, I changed the wp_register_script call for ‘jetpack-gallery-settings’ in both class.jetpack.php and functions.gallery.php.

    This fix works in the latest v4.1.1 Jetpack.

    https://wordpress.org/plugins/jetpack/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Jeremy Herve

    (@jeherve)

    Jetpack Mechanic

    I can’t seem to reproduce the issue on my end. The script is indeed added in the head, but that shouldn’t be an issue, it’s added after the media uploader.

    Do you use any other plugins on that site? If so, could you try to deactivate them, one at a time, and let me know if you find a conflicting plugin? If that doesn’t help, could you try to switch to one of the default themes for a few minutes, and let me know how it goes?

    Same here. WordPress 4.6.1, latest updates all installed for plugins. If Akismet and Jetpack are active at the same time I can not use add media button and switch from visual to text layout in posts.
    Deactivated Akismet now cuz Jetpack is more important.

    Plugin Contributor Jeremy Herve

    (@jeherve)

    Jetpack Mechanic

    @ryder203 Could you add the following to your site’s wp-config.php file?

    
    define( 'WP_DEBUG', true );
    
    if ( WP_DEBUG ) {
    
            @error_reporting( E_ALL );
            @ini_set( 'log_errors', true );
            @ini_set( 'log_errors_max_len', '0' );
    
            define( 'WP_DEBUG_LOG', true );
            define( 'WP_DEBUG_DISPLAY', false );
            define( 'CONCATENATE_SCRIPTS', false );
            define( 'SAVEQUERIES', true );
    
    }
    

    Once you’ve done so, could you enable both plugins again, and then check for Javascript errors on the editor page, as explained here:
    http://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors

    Let me know what you find!

    Today I did the same thing again as when the error occured; cleared all caches in browser, cleared all WP caches (WP supercache) and activated Akismet again (with the added code for debug in config PHP file). Started a new post but the error was gone. No error in java dev console view (as you told me to look there). I have no clue what’s going on – the interface is working as it should. Thanks anyway, Sir.

    • This reply was modified 11 months, 1 week ago by  ryder203.
    Plugin Contributor Jeremy Herve

    (@jeherve)

    Jetpack Mechanic

    Well, I’m not sure what fixed it, but I’m glad everything is working again for you 🙂

    If it starts happening again, check your browser console and let me know what you find!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘"Add Media" Uploads broken with Jetpack activated’ is closed to new replies.