Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #983738

    After the latest update the media modal is not working anymore on the frontend.
    Before everything works as expected.
    If I switch the theme away from Enfold, everything works as expected.

    For the frontend we use the standard WordPress media modal uploader. The same as on the backend.
    Therefore we use the function wp_enqueue_media(); on the wp_enqueue_scripts hook for loading all the wp.media dependencies.

    So no, this is not the problem! The standard WordPress media modal image Uploader worked.
    Now it hast stopped working!
    On a clean testinstallation without Enfold, the Media Uploader works.
    When I activate Enfold in the latest version, the Media Modal doesn’t work and I geht the known error:
    TypeError: wp.media is undefined

    This error occurs, if you don’t enqueue the media modal dependencies.
    If you do the wp_enqueue_media() function on the wp_enqueue_scripts hook, everything workes.
    Before the latest Enfold update…

    I assume, that you remove things in the wp_enqueue_media() function with hooks.

    This happens only on the frontend, in the backend (wp_admin()) the media modal works as expected.

    And no, no performance options from Enfold are set.
    We left the performance options untouched!
    Neither were css or Js files merged nor are builder elements disabled.

    #983920

    Hey kaoh,

    Thank you for using Enfold.

    Where can we see the issue? The theme doesn’t contain any hooks or filters that should interfere with the wp_enqueue_media function. The theme actually loads the same script on the theme options page.

    Best regards,
    Ismael

    #985635

    we will make a testinstallation to reproduce this and then I handle you the credentials to log in ant test everything! please stay tuned!

    #985822

    Hi,

    Alright. Let us know once the staging site is ready.

    Best regards,
    Ismael

    #991882

    Hello, we face the identical issue with the latest Enfold Theme Version 4.4.1.
    We use the plugin http://wpfrontendpublishing.com/ and added an image upload dialog. This works works with an older versions of Enfold Theme but not anymore with 4.4.1 or even 4.4.0.

    We get the identical JavaScript error as above: TypeError: wp.media is undefined

    Thanks for your help!

    I provide you the credentials to a test environment to reproduce it easily:

    #992007

    Hi,

    Can you please try the following and check:

    In file enfold\functions.php line 419 you find:

    
    $condition2 = ( version_compare( get_bloginfo( 'version' ), '4.9', '>=' ) ) && $condition;
    

    Before this line add:

    
    $condition = true;
    

    If you want us to do do that, please give us admin access and FTP access to your server.

    Best regards,
    Günter

    #992089

    Perfect, your suggestion with $condition = true; solved the problem!

    Thank you for the super fast solution and this excellent support!
    Best Regards, Chris

    #992216

    Hi,

    Awesome! Glad we could help!

    Please take a moment to review our theme and show your support https://themeforest.net/downloads
    Don’t forget to bookmark Enfold Documentation for future reference.

    Thank you for using Enfold :)

    Best regards,
    Ismael

    #993991

    Hi,

    I added a filter so it is no longer necessary to hack the source code:

    
    		/**
    		 * Allow to force loading of WP media element for 3rd party plugins
    		 * 
    		 * @since 4.1.2 
    		 * @param boolean $condition 
    		 * @param array $options
    		 * @return boolean
    		 */
    		$condition = apply_filters( 'avf_enqueue_wp_mediaelement', $condition, $options );
    

    Return true for pages that need the media element.

    Should be in the next update.

    Best regards,
    Günter

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘wp_enqueue_media() not working on frontend after latest update’ is closed to new replies.