Last active
February 9, 2019 15:50
-
-
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.
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 | |
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 ); |
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 | |
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