Auto play audio using WP Maintenance Mode Plugin

I am using the plugin ‘WP Maintenance Mode’ to load a under maintenance website on a website.

I would like for audio to play as soon as somebody lands on the website and for audio player to remain invisible.

p style=text-align: center;BACK SOON/p

[audio src=https://myWebsite/wp-content/uploads/2021/03/audio.mp3]

This will load the page and show the audio player and it will play when I press play

I have tried

[audio src=https://myWebsite/wp-content/uploads/2021/03/audio.mp3 width = 0 height = 0 autoplay=1]

to try and get it to play automatically and without the audio player, but no success.

Topic audio plugins Wordpress

Category Web


A couple of things:

  • First, this code has some syntax issues - the src attribute isn't properly closed. Further, as noted by @Rup, autoplay should have a value of on:

Broken tag:

[audio src="https://myWebsite/wp-content/uploads/2021/03/audio.mp3 width = "0" height = "0" autoplay=1]

Fixed

[audio src="https://myWebsite/wp-content/uploads/2021/03/audio.mp3" width="0" height="0" autoplay="on"]
  • Second, I'm not 100% sure that WP Maintenance posts can process shortcodes. I would instead use a standard HTML Audio Tag.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.