wp_audio_shortcode

Filters the audio shortcode output.

Description

apply_filters( 'wp_audio_shortcode', (string) $html, (array) $atts, (string) $audio, (int) $post_id, (string) $library ); 

Parameters (5)

0. $html (string)
Audio shortcode HTML output.
1. $atts (array)
Array of audio shortcode attributes.
2. $audio (string)
Audio file.
3. $post_id (int)
The post id.
4. $library (string)
Media library used for the audio shortcode.

Usage

To run the hook, copy the example below.
  1. $html = apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library ); 
  2.  
  3. if ( !empty( $html ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_audio_shortcode callback 
  2. function filter_wp_audio_shortcode( $html, $atts, $audio, $post_id, $library ) { 
  3. // make filter magic happen here... 
  4. return $html
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_audio_shortcode', 'filter_wp_audio_shortcode', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_audio_shortcode', 'filter_wp_audio_shortcode', 10, 5 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/media.php  
  1. return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );