How to use default image as featured image by implement some code in function.php

Question

I want to use a default image as a featured image for all those Posts and Pages, where is not any selected featured image from media.
I have tried this code in function.php but not working,

function filter_post_thumbnail( $html ) { if ( '' == $html ) { return '<img src="https://www.wptricks.com/wp-content/uploads/2020/08/Google_Lens_-_new_logo.png" />'; } // Else, return the post thumbnail return $html; } add_filter( 'post_thumbnail_html', 'filter_post_thumbnail' );

Have any solution by implementing some piece of code in function.php file?

0
, , Puneet Verma 2 years 2020-08-29T14:10:53-05:00 0 Answers 50 views 0

Leave an answer

Browse
Browse