Title: wp_embed_handler_audio
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_embed_handler_audio( array $matches, array $attr, string $url, array $rawattr ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#wp--skip-link--target)

Audio embed handler callback.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#parameters)󠁿

 `$matches`arrayrequired

The RegEx matches from the provided regex when calling [wp_embed_register_handler()](https://developer.wordpress.org/reference/functions/wp_embed_register_handler/).

`$attr`arrayrequired

Embed attributes.

`$url`stringrequired

The original URL that was matched by the regex.

`$rawattr`arrayrequired

The original unmodified attributes.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#return)󠁿

 string The embed HTML.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#source)󠁿

    ```php
    function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
    	$audio = sprintf( '"%s"', esc_url( $url ) );

    	/**
    	 * Filters the audio embed output.
    	 *
    	 * @since 3.6.0
    	 *
    	 * @param string $audio   Audio embed output.
    	 * @param array  $attr    An array of embed attributes.
    	 * @param string $url     The original URL that was matched by the regex.
    	 * @param array  $rawattr The original unmodified attributes.
    	 */
    	return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/embed.php#L272)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/embed.php#L272-L286)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_embed_handler_audio’, string $audio, array $attr, string $url, array $rawattr )](https://developer.wordpress.org/reference/hooks/wp_embed_handler_audio/)

Filters the audio embed output.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#related)󠁿

| Uses | Description | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_embed_handler_audio%2F)
before being able to contribute a note or feedback.