WordPress generating 404 on .mp4 file in theme folder

Using get_template_directory_uri() or get_stylesheet_directory_uri() you can retrieve the url to your themes folder, and after that you just need to specify the path starting from there. Your code should look like this:

<source src="https://wordpress.stackexchange.com/questions/256580/<?php echo get_template_directory_uri() ."/assets/videos/videobg.mp4'; ?>" type="video/mp4">

Leave a Comment