How Do I Make a YouTube Video Play Automatically in WordPress?

Making a YouTube video automatically play in WordPress is easy. Simply add the following code to your theme’s functions.php file:

// Add a function to make videos play automatically function play_video() { wp_play_video( ‘https://www.youtube.

com/watch?v= ‘ . get_video_title() . ‘&version=3′ ); } add_action( ‘wp_head’, ‘play_video’ );.

That’s it! Your videos will play automatically when users visit your WordPress site. If you want to disable video playback on specific pages, you can add the following conditional code to your functions.php file:

// Disable video playback on specific pages function disable_video_playback() { wp_play_video( ‘https://www. ‘&version=3′ ); } add_action( ‘wp_head’, ‘disable_video_playback’ );.