WordPress Plugin // Remove video player

Comments

10 comments

  • Avatar
    Loic Verger Del Bove

    Hi Holger,

    We are aware of this issue where scripts are being loaded even when not used and are working on mitigating the issue. 

    In the meantime, let me check with my team if there is a custom hook we could share in order to not run the script.

    Hope that makes sense.

    Best,

    Loic

    0
    Comment actions Permalink
  • Avatar
    Holger Oppermann

    Hi Loic,

    once again I need to say, that I REALLY appreciate your support! Many thanks for your reply and help!

    I´ve tried different solutions regarding the loading time of the function, or using "wp_print_scripts ()", "wp_dequeue_script()" or "wp_enque_script() - but nothing helped.

    So if you maybe could help me with a custom hook - that would be awesome!

    If there would be anything I could provide to help - just let me know ...

    Many thanks in advance

    Best,
    Holger

    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi Holger,

    May I ask you to try this custom hook:


    <?php
    function remove_cld_player() {
    if ( ! is_admin() ) {
    wp_dequeue_script( 'cld-core' );
    wp_dequeue_script( 'cld-player' );
    }
    }
    add_action( 'wp_print_scripts', 'remove_cld_player', 100 );

    function remove_cld_player_styles() {
    if ( ! is_admin() ) {
    wp_dequeue_style( 'cld-player' );
    wp_dequeue_style( 'cld-player-local' );
    }
    }
    add_action( 'wp_print_styles', 'remove_cld_player_styles', 100 );

    Thanks for letting me know if that works for you.

    Best,

    Loic

    0
    Comment actions Permalink
  • Avatar
    Holger Oppermann

    Hi Loic,

    BIG thanks for your kind help and the custom hook! But it seems, the script(s) are a little bit "persistent" ;). I´ve tried your code, but both of the scripts are still being loaded. So I did some other tries also with

    if (  ! is_user_logged_in() ) 

    and furthermore changing the script names to "cld-player-js" or "cld-core-js".  Finally it ended up with this code:

    function remove_cld_player()
    {
    if ( ! is_admin() ) {
    wp_dequeue_script('cld-core', 'https://unpkg.com/cloudinary-core@2.6.3/cloudinary-core-shrinkwrap.min.js', array(), '2.6.3', true);
    wp_dequeue_script('cld-player', 'https://unpkg.com/cloudinary-video-player@1.4.0/dist/cld-video-player.min.js', array(), '1.4.0', true);
    }
    }
    add_action('wp_print_scripts', 'remove_cld_player', 100 );

    function remove_cld_player_style() {
    if ( ! is_admin() ) {
    wp_dequeue_style( 'cld-core' );
    wp_dequeue_style( 'cld-player' );
    }
    }
    add_action('wp_print_scripts', 'remove_cld_player_style', 100 );

    but anyhow - despite all the attempts, the scripts are still loaded (Browser Cache has been cleared each time).

    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi Holger,

    Thanks for getting back to me.

    I am checking internally this script. Also, for your information, this issue will be fixed in our next release on Monday, so it may not be worth spending time on this and wait for the version 2.7.0.

    Hope that makes sense.

    Best,

    Loic

    0
    Comment actions Permalink
  • Avatar
    Holger Oppermann

    Hi Loic,

    big thanks for your update, especially regarding the upcoming release on Monday!
    Therefore - you can close this topic. There would be no more need for a "deeper investigation" or manual coding. The topic is not so urgent, that I can not wait until the next update :)

    I want to say a big thanks for your outstanding and kind support, which I´ll recommend to my circle of friends and acquaintances, as well as Cloudinary itself.

    Best,

    Holger

    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi Holger,

    Thanks for the update and the kind words.

    I'll reach out to you through the thread when we have released the new version.

    In the meantime, I wish you a great weekend.

    Best,

    Loic

    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi Holger,

    Hope you are doing well.

    We have just released the version `2.7.0` of our plugin, could you please upgrade and see if that fixes your issue.

    Thanks in advance.
    Best,
    Loic

    0
    Comment actions Permalink
  • Avatar
    Holger Oppermann

    Hi Loic,

    many thanks for your info! I´ve just intalled the new version - and: the player script wasn´t loaded anymore! ;) Perfect! Thank you for including this topic in your update!

    Best,
    Holger

    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi Holger,

    Thanks for confirming it is working, I am glad we were able to help.

    Have a great rest of the day.

    Best,

    Loic

    0
    Comment actions Permalink

Please sign in to leave a comment.