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

---

# wp_mediaelement_fallback( string $url ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#user-contributed-notes)

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

Provides a No-JS Flash fallback as a last resort for audio / video.

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

 `$url`stringrequired

The media element URL.

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

 string Fallback HTML.

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

    ```php
    function wp_mediaelement_fallback( $url ) {
    	/**
    	 * Filters the MediaElement fallback output for no-JS.
    	 *
    	 * @since 3.6.0
    	 *
    	 * @param string $output Fallback output for no-JS.
    	 * @param string $url    Media file URL.
    	 */
    	return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
    }
    ```

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

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

 [apply_filters( ‘wp_mediaelement_fallback’, string $output, string $url )](https://developer.wordpress.org/reference/hooks/wp_mediaelement_fallback/)

Filters the MediaElement fallback output for no-JS.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?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.

  |

| Used by | Description | 
| [wp_video_shortcode()](https://developer.wordpress.org/reference/functions/wp_video_shortcode/)`wp-includes/media.php` |

Builds the Video shortcode output.

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

Builds the Audio shortcode output.

  |

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

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

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/?output_format=md#comment-content-1543)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/wp_mediaelement_fallback/#comment-1543)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_mediaelement_fallback%2F%23comment-1543)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_mediaelement_fallback%2F%23comment-1543)
 4. **Basic Example**
 5.     ```php
        $fallback = wp_mediaelement_fallback( '/wp-content/uploads/2013/06/my-audio-file.mp3' );
        echo $fallback;
        ```
    
 6. Returns this HTML:
 7.     ```php
        <a href="/wp-content/uploads/2013/06/my-audio-file.mp3">/wp-content/uploads/2013/06/my-audio-file.mp3</a>
        ```
    
 8.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_mediaelement_fallback%2F%3Freplytocom%3D1543%23feedback-editor-1543)

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