Title: Using wp_oembed_get within Iframe getting Forbidden error
Last modified: August 30, 2016

---

# Using wp_oembed_get within Iframe getting Forbidden error

 *  [loisbritto](https://wordpress.org/support/users/loisbritto/)
 * (@loisbritto)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/using-wp_oembed_get-within-iframe-getting-forbidden-error/)
 * Hello!
    I’m new on PHP and I’m trying to embed a youtube video on WordPress. 
   I created an Advanced Custom Field where the user can simply put the name of 
   the video and paste the url. With the code below it seems to work well but…
 * >  <?php $loop = new WP_Query( array( ‘post_type’ => ‘course_video’,
   >  ‘orderby’
   > => ‘post_id’, ‘order’ => ‘ASC’ ) ); ?>
   >  <?php while( $loop->have_posts() ) : $loop->the_post(); ?>
   >  <h2><?php the_title(); ?></h2>
   >  <?php echo wp_oembed_get( get_field( ‘video_url’ ) ) ?>
   >  <?php endwhile; wp_reset_query(); ?>
 * I’d like to see the video wider and then I tried this similar code:
 * >  <?php $loop = new WP_Query( array( ‘post_type’ => ‘course_video’,
   >  ‘orderby’
   > => ‘post_id’, ‘order’ => ‘ASC’ ) ); ?>
   >  <?php while( $loop->have_posts() ) : $loop->the_post(); ?>
   >  <h2><?php the_title(); ?></h2>
   >  <iframe width=”100%” height=”415″
   >  src=”<?php echo wp_oembed_get( get_field(‘
   > video_url’ ) ) ?>” frameborder=”0″ allowfullscreen></iframe>
   >  <?php endwhile; wp_reset_query(); ?>
 * And I get this error:
 * >  Forbidden
   > You don’t have permission to access /b2w/
   > Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80
 * There’s any way to resize the video using my first code? And what I’m doing wrong
   in the second code?
 * I’m stuck with this, I searched a lot and I didn’t find the reason neither a 
   different approach to get this working well.
 * Thanks in advance

The topic ‘Using wp_oembed_get within Iframe getting Forbidden error’ is closed 
to new replies.

## Tags

 * [embed](https://wordpress.org/support/topic-tag/embed/)
 * [forbidden](https://wordpress.org/support/topic-tag/forbidden/)
 * [iframe](https://wordpress.org/support/topic-tag/iframe/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [Youtube](https://wordpress.org/support/topic-tag/youtube/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [loisbritto](https://wordpress.org/support/users/loisbritto/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/using-wp_oembed_get-within-iframe-getting-forbidden-error/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
