Snippets: Add a Fallback Featured Image for Blog Posts

function myprefix_blog_thumbnail_fallback( $args ) {
	if ( ! get_post_thumbnail_id() ) {
		$args['attachment'] = 'YOUR_ATTACHMENT_ID'; // Upload the fallback image to wordpress and add it's post ID here
	}
	return $args;
}
add_filter( 'wpex_blog_entry_thumbnail_args', 'myprefix_blog_thumbnail_fallback' );
add_filter( 'wpex_blog_post_thumbnail_args', 'myprefix_blog_thumbnail_fallback' );

Snippet Type: PHP

Posted Under: Blog

All PHP snippets should be added via a child theme's functions.php file.