0

I can see these bits of code in the source in my wp install:

<!-- jQuery -->
<script type="text/html" id="tmpl-wp-playlist-current-item">
    <# if ( data.image ) { #>
    <img src="{{ data.thumb.src }}" alt="" />
    <# } #>
    <div class="wp-playlist-caption">
        <span class="wp-playlist-item-meta wp-playlist-item-title">&#8220;{{ data.title }}&#8221;</span>
        <# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #>
        <# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #>
    </div>
</script>
<script type="text/html" id="tmpl-wp-playlist-item">
    <div class="wp-playlist-item">
        <a class="wp-playlist-caption" href="{{ data.src }}">
            {{ data.index ? ( data.index + '. ' ) : '' }}
            <# if ( data.caption ) { #>
                {{ data.caption }}
            <# } else { #>
                <span class="wp-playlist-item-title">&#8220;{{{ data.title }}}&#8221;</span>
                <# if ( data.artists && data.meta.artist ) { #>
                <span class="wp-playlist-item-artist"> &mdash; {{ data.meta.artist }}</span>
                <# } #>
            <# } #>
        </a>
        <# if ( data.meta.length_formatted ) { #>
        <div class="wp-playlist-item-length">{{ data.meta.length_formatted }}</div>
        <# } #>
    </div>
</script>

I've tried to dequeue but it doesn't stop loading. I added:

function my_dequeue_script() {
 wp_dequeue_script( 'mediaelement' );
 wp_dequeue_script( 'wp-mediaelement' );
 wp_dequeue_script( 'wp-playlist' );
 wp_dequeue_script( 'wp-embed' );
}

add_action( 'wp_print_scripts', 'my_dequeue_script', 100 );

and

function my_deregister_scripts(){
    wp_dequeue_script( 'mediaelement' );
 wp_dequeue_script( 'wp-mediaelement' );
 wp_dequeue_script( 'wp-playlist' );
  wp_deregister_script( 'wp-embed' );
}
add_action( 'wp_footer', 'my_deregister_scripts' );

Neither of them removes the scripts furthermore I'd like to remove those snippets of code, I think they're for audio, I'm not going to use it so how can I remove those using the functions.php? What are the implications of removing those if I don't ever use audio files?

  • Looking at core code the only time these scripts should be output are if you're using the playlist shortcode, which requires them. So if they're appearing then you're using them somewhere. – Jacob Peattie Nov 29 '17 at 14:31
-1

I used the following code and the bits of code no longer appear:

add_action( 'wp_head', 'remove_my_action' );
function remove_my_action(){
    remove_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
    remove_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.