Skip to content

Instantly share code, notes, and snippets.

@jdevalk
Last active February 9, 2019 15:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdevalk/5459982 to your computer and use it in GitHub Desktop.
Save jdevalk/5459982 to your computer and use it in GitHub Desktop.
If you have the YouTube code in your post excerpt, this will fix it.
<?php
function fix_content_input( $content, $vid ) {
$post = get_post( $vid['post_id'] );
if ( !empty( $post->post_excerpt ) ) {
$content = "\n" . 'http://youtube.com/v/'. $post->post_excerpt . "\n" . $content;
}
return $content;
}
add_filter( 'wpseo_video_index_content', 'fix_content_input', 10, 2 );
<?php
function fix_content_input( $content, $vid ) {
$post_meta = get_post_meta( $vid['post_id'], 'youtube', true );
if ( !empty( $post_meta ) ) {
$content = "\n" . 'http://youtube.com/v/'. $post_meta . "\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