Skip to content

Instantly share code, notes, and snippets.

@jdevalk jdevalk/post_excerpt.php
Last active Feb 9, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.