Changing the default settings for the WordPress Media Player

WordPress offers the possibility to add videos and audio files. To play these files a default media player is available. It is based on MediaElement.js and has been included since WordPress 3.6.

For a project, I recently worked on, videos were used on the web site. By default WordPress displays videos with the control buttons at the bottom. But in the design just the play button in the middle of the video was desired. So I had to figure out how to adjust the player settings.

Unfortunately, I couldn’t find any documentation in the Codex. So I looked into the WordPress source code to see how the player is called. I discovered that a mejs_settings filter is available to change the player settings. So below is the code I used to hide the video controls buttons.


<?php
function my_mejs_settings( $settings ) {
  $settings['hideVideoControlsOnLoad'] = true;

  return $settings;
}
add_filter( 'mejs_settings', 'my_mejs_settings' );

Of course there are far more settings you can change. Take a look at the MediaElement.js API to see what is available.

Back to top