I’ve added the custom field in the admin, but the plugin still doesn’t recognise my Vimeo video?

As of Yoast SEO 20.0, the settings interface inside our plugins has received a major overhaul. Please update to the latest version of Yoast SEO if your plugin does not look like the screenshots you encounter in our Help center.

When using a custom field for your Vimeo video, you probably only had to enter the ‘variable’ Vimeo uses to show your video. There is no way our plugin knows what this code means without extra information.

To solve this, you can add the following code to you functions.php (Theme file).

/* Takes the Vimeo video ID stored in a custom field and
 * adds a full Vimeo URL to the content to allow
 * the video SEO plugin to index it.
 * The video URL is added to the top of content to make
 * it override other video's in the post.
 * @param string $content the input content field.
 * @param array $vid the video array for the post.
 * @return string $content

add_filter( 'wpseo_video_index_content', 'fix_content_input', 10, 2 );

function fix_content_input( $content, $vid ) {
 $custom_field_name = 'id_vimeo';
 $video_id = get_post_meta( $vid['post_id'], $custom_field_name, true );
 $content = "n" . 'http://vimeo.com/'. $video_id . "n" . $content;
 return $content;

Haven’t added the custom field to our plugin-settings yet? Check our installation guide.

Get free SEO tips!