I am using WordPress’ latest custom video header feature. Anybody has an idea how to stop autoplay? Checked filters but did not find a way to disable autoplay.
/wp-includes/js/wp-custom-header.js
has the default settings. However not getting any clue how I may override it without editing core files 😉
1 Answer
I don’t think there is a need to override any core files. You can just use javascript to stop autoplaying the video.
I tested the following code on Twenty Seventeen theme and it works fine.
For example:
$( document ).ready( function() {
$( document ).on( 'wp-custom-header-video-loaded', function() {
$("#wp-custom-header-video").attr('autoplay',false);
});
});
This does the trick.