Skip to content

Snippet: Add Custom Params to Lightbox Videos

If you want to modify the video embed URLs used in lightboxes in the Total WordPress Theme, you can use the wpex_get_video_embed_url_params filter.

This filter allows you to add or change URL query parameters for YouTube and Vimeo embeds. It’s useful when you want to control how videos behave; such as enabling autoplay, muting audio, hiding controls, or looping playback, by appending parameters directly to the embed URL.

/*
 * Add custom parameters to lightbox video embed urls.
 * This example enables autoplay for YouTube videos loaded in the lightbox.
 */
add_filter( 'wpex_get_video_embed_url_params', function() {
	return [
		'youtube' => [
			'autoplay' => 1
		],
	];
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top