Title: Do_Shortcode not working for Embed
Last modified: August 21, 2016

---

# Do_Shortcode not working for Embed

 *  [fukr](https://wordpress.org/support/users/fukr/)
 * (@fukr)
 * [12 years ago](https://wordpress.org/support/topic/do_shortcode-not-working-for-embed/)
 * To make life easier, I’d like to retrieve the video URL from a custom field and
   then output the full video code.
    I’ve used do_shortcode but it did nothing `
   <?php echo do_shortcode('[embed]Youtube URL[/embed]'); ?>`, Then I searched around
   and seems this should be the solution. [http://wordpress.org/support/topic/call-function-called-by-embed-shortcode-direct#post-1577437](http://wordpress.org/support/topic/call-function-called-by-embed-shortcode-direct#post-1577437)
   [http://wordpress.stackexchange.com/questions/22524/do-shortcode-not-working-for-embed](http://wordpress.stackexchange.com/questions/22524/do-shortcode-not-working-for-embed)
 *     ```
       <?php global $wp_embed;
       echo $wp_embed->run_shortcode('[embed]Youtube URL[/embed]');?>
       ```
   
 * Again it failed to display the video but a hyper-linked URL.
 * Appreciate any help from you. Many thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [J M](https://wordpress.org/support/users/hiphopinenglish/)
 * (@hiphopinenglish)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/do_shortcode-not-working-for-embed/#post-4997891)
 * I’m using [`wp_oembed_get`](http://codex.wordpress.org/Function_Reference/wp_oembed_get)
   like so:
 *     ```
       <?php $url = get_post_meta($post->ID, '_cmb_video_url', true);
       echo wp_oembed_get($url, ''); ?>
       ```
   
 * Where I have the URL stored in post meta.
 *  Thread Starter [fukr](https://wordpress.org/support/users/fukr/)
 * (@fukr)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/do_shortcode-not-working-for-embed/#post-4997919)
 * Does it work for you? It returns nothing on my side.
 *  [J M](https://wordpress.org/support/users/hiphopinenglish/)
 * (@hiphopinenglish)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/do_shortcode-not-working-for-embed/#post-4997956)
 * Yes, it does. I’m using this in a few places and it works with plain YouTube 
   URLs. Are you absolutely sure you’re getting the right piece of data?
    The other
   thing I’ve just thought of is that hardcoding a link did not work for me. I’m
   grabbing URLs stored in post meta.
 *  Thread Starter [fukr](https://wordpress.org/support/users/fukr/)
 * (@fukr)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/do_shortcode-not-working-for-embed/#post-4998018)
 * Thanks for your reply.
    I am sure I am getting the right data.
 * And I’ve tried both the hardcoding video link and link from post meta.
    But failed..
 *  [J M](https://wordpress.org/support/users/hiphopinenglish/)
 * (@hiphopinenglish)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/do_shortcode-not-working-for-embed/#post-4998036)
 * What does print_r return you for your wp_oembed_get variable?
    e.g.
 *     ```
       $url = get_post_meta( $post-ID, 'my_video_meta_key', true);
       $embed = wp_oembed_get( $url, '' );
       echo '<pre>';
       print_r ($embed);
       echo '</pre>';
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Do_Shortcode not working for Embed’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [J M](https://wordpress.org/support/users/hiphopinenglish/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/do_shortcode-not-working-for-embed/#post-4998036)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
