YouTube video links broken

I’m using the WordPress X Theme. All of the YouTube video links in my Case Studies section are broken. Sorry I can’t say when they broke – it’s been a while since I’ve checked in on my site.

Here’s an example of one of the Console errors from Chrome:
“Failed to load resource: the server responded with a status of 404 (Not Found)”
The videos are on YouTube and the URLs seem to be formatted correctly, but every video has the same error.

I didn’t change anything about any of the links and they were all working for a long time.

I contacted my host to make sure it wasn’t something on their end. They rolled back to PHP5.6 from PHP7.1 to make sure it wasn’t a PHP update issue. Problem was not solved.

I tried using just the video link alone as well as with the YouTube embed code – neither work.

Any help you can offer would be greatly appreciated

Hello Martin,

Thanks for writing in! I can confirm that this is a bug in the X 6.5.6 release. Our developers have already fixed this issue and will be releasing an update anytime soon.

You can revert back to version X 6.5.5 if you still have a backup copy. And if there is none, you may need to add the following code in your child theme’s functions.php file:

// Custom Featured Video
// =============================================================================

if ( ! function_exists( 'x_featured_video' ) ) :
  function x_featured_video( $post_type = 'video' ) {

    $entry_id     = get_the_ID();
    $stack        = x_get_stack();
    $aspect_ratio = get_post_meta( $entry_id, '_x_' . $post_type . '_aspect_ratio', true );
    $m4v          = get_post_meta( $entry_id, '_x_' . $post_type . '_m4v', true );
    $ogv          = get_post_meta( $entry_id, '_x_' . $post_type . '_ogv', true );
    $embed        = get_post_meta( $entry_id, '_x_' . $post_type . '_embed', true );
    $fullwidth    = ( in_array( 'x-full-width-active', get_body_class() ) ) ? true : false;

    if ( $fullwidth ) {
      $poster = wp_get_attachment_image_src( get_post_thumbnail_id( $entry_id ), 'entry-fullwidth', false );
    } else {
      $poster = wp_get_attachment_image_src( get_post_thumbnail_id( $entry_id ), 'entry', false );
    }

    if ( $embed != '' ) {
      echo do_shortcode( '[x_video_embed type="' . $aspect_ratio . '" no_container="true" class="mvn"]' . stripslashes( wp_specialchars_decode( $embed, ENT_QUOTES ) ) . '[/x_video_embed]' );
    } else {
      echo do_shortcode( '[x_video_player m4v="' . $m4v . '" ogv="' . $ogv . '" poster="' . $poster[0] . '" type="' . $aspect_ratio . '" advanced_controls="true" preload="metadata" hide_controls="false" autoplay="false" loop="false" muted="false" no_container="true" class="custom by x staff mvn"]' );
    }

  }
endif;

This is a temporary fix. You may remove this when the X 7.0 will be available anytime soon.

Hope this helps. Please let us know how it goes.

Thank you so much for your quick response. The patch in the child theme functions.php worked like a charm :grinning:

We are delighted to assist you with this.

Cheers!

Hi. I am also having this problem. I can’t seem to get the Video Embed to work with a YouTube video. I am running v7.0 of X

Hey There,

Please provide us with a link to the site so we can take a look. Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.