Filters In Youtube Favorite Video Posts

Today’s update of Youtube Favorite Video Posts includes a couple filters that can be used to modify the post title and content whenever new items are saved. Here are a few snippets that show the filters in action. These can be added to your theme’s functions.php file, or, as is often applicable, to the child theme you have created from your primary theme of choice.

/* A brief overview of filters that are now available in Youtube Favorite Video Posts.
 * These allow easy overriding of the default post title and content before the
 * new post is created.

add_filter( 'yfvp_new_video_embed_code', 'myprefix_change_yfvp_post_content', 10, 1 );
/* Adds a little nonsense introduction to the video before embedding the 
 * iframe that was provided by default */
function myprefix_change_yfvp_post_content( $video_embed_code, $video_token ) {

	$new_content = 'My video post includes the token - ' . $video_token . ' - before embedding!';
	$new_content .= $video_embed_code;

	return $new_content;

add_filter( 'yfvp_new_video_item_title' 'myprefix_change_yfvp_post_title', 10, 1 );
/* Changes the default title from Youtube */
function myprefix_change_yfvp_post_title( $current_title ) {
	return 'This is a video: ' . $current_title;

Youtube Favorite Video Posts can be downloaded through the WordPress plugin repository. More info can be found through the overall project status page.

Leave a Reply