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

---

# wp_oembed_get( string $url, array|string $args ): string|false

## In this article

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

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

Attempts to fetch the embed HTML for a provided URL using oEmbed.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_oembed_get/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/wp_oembed_get/?output_format=md#see-also)󠁿

 * [WP_oEmbed](https://developer.wordpress.org/reference/classes/wp_oembed/)

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

 `$url`stringrequired

The URL that should be embedded.

`$args`array|stringoptional

Additional arguments for retrieving embed HTML. Default empty.

 * `width` int|string
 * Optional. The `maxwidth` value passed to the provider URL.
 * `height` int|string
 * Optional. The `maxheight` value passed to the provider URL.
 * `discover` bool
 * Optional. Determines whether to attempt to discover link tags at the given URL
   for an oEmbed provider when the provider URL is not found in the built-in providers
   list. Default true.

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

 string|false The embed HTML on success, false on failure.

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

    ```php
    function wp_oembed_get( $url, $args = '' ) {
    	$oembed = _wp_oembed_get_object();
    	return $oembed->get_html( $url, $args );
    }
    ```

[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#L113)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/embed.php#L113-L116)

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

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

Returns the initialized [WP_oEmbed](https://developer.wordpress.org/reference/classes/wp_oembed/) object.

  |

| Used by | Description | 
| [WP_Widget_Media_Video::render_media()](https://developer.wordpress.org/reference/classes/wp_widget_media_video/render_media/)`wp-includes/widgets/class-wp-widget-media-video.php` |

Render the media on the frontend.

  | 
| [WP_Embed::shortcode()](https://developer.wordpress.org/reference/classes/wp_embed/shortcode/)`wp-includes/class-wp-embed.php` |

The [do_shortcode()](https://developer.wordpress.org/reference/functions/do_shortcode/) callback function.

  |

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

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

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

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/wp_oembed_get/?output_format=md#comment-content-688)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_oembed_get/#comment-688)
 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_oembed_get%2F%23comment-688)
     Vote results for this note: 2[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_oembed_get%2F%23comment-688)
 4.  Retrieve the embed code for a URL from a supported `oEmbed` provider – with `width`
     argument:
 5.      ```php
         $embed_code = wp_oembed_get( 'http://www.youtube.com/watch?v=AbcDeFg123', array( 'width' => 400 ) );
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_oembed_get%2F%3Freplytocom%3D688%23feedback-editor-688)
 7.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/wp_oembed_get/?output_format=md#comment-content-687)
 8.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_oembed_get/#comment-687)
 9.  [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_oembed_get%2F%23comment-687)
     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_oembed_get%2F%23comment-687)
 10. Retrieve the embed code for a URL from a supported `oEmbed` provider:
 11.     ```php
         $embed_code = wp_oembed_get( 'http://www.youtube.com/watch?v=AbcDeFg123' );
         ```
     
 12.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_oembed_get%2F%3Freplytocom%3D687%23feedback-editor-687)

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