-
-
Save jdevalk/0641e42ef304370bc864 to your computer and use it in GitHub Desktop.
This takes the youtube video ID stored in a custom field and adds a full Youtube URL to the content to allow the video plugin to easily index it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Takes the youtube video ID stored in a custom field and adds a full Youtube 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 ) { | |
$youtube_id = get_post_meta( $vid['post_id'], 'video', true ); | |
$content = "\n" . 'http://youtube.com/v/'. $youtube_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