Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use the post's featured image when the EasyRecipe doesn't have an image.
<?php
/**
* Use the post's featured image when the EasyRecipe doesn't have an image.
*
* @param integer $image_id Image ID to be used.
* @param object $recipe Tasty Recipe object.
* @param integer $post_id Original post ID.
*/
add_filter( 'tasty_recipes_convert_easyrecipe_image_id', function( $image_id, $recipe, $post_id ) {
if ( $image_id ) {
return $image_id;
}
return get_post_thumbnail_id( $post_id );
}, 10, 3 );
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.