Skip to content

Instantly share code, notes, and snippets.

@jdevalk
Last active December 11, 2015 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdevalk/4b998471ce8a5635f964 to your computer and use it in GitHub Desktop.
Save jdevalk/4b998471ce8a5635f964 to your computer and use it in GitHub Desktop.
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.
<?php
/**
* 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
*/
function fix_content_input( $content, $vid ) {
$video_id = get_post_meta( $vid['post_id'], 'id_vimeo', true );
$content = "\n" . 'http://vimeo.com/'. $video_id . "\n" . $content;
return $content;
}
add_filter( 'wpseo_video_index_content', 'fix_content_input', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment