$_img ) { if ( substr( $_img , 0, strlen( "{$img_name}" ) ) === "{$img_name}" ) { unset( $new_candidates[ $_key ] ); } } $GLOBALS['demo_img'] = $new_candidates; return get_template_directory_uri() . '/wp-pre-image/img/' . $img_name; } /** * Filter thumbnail image * * @param string $input Post thumbnail. */ function bizwhoop_the_post_thumbnail( $input ) { if ( empty( $input ) ) { $placeholder = bizwhoop_get_demo_img_src(); return ''; } return $input; } add_filter( 'post_thumbnail_html', 'bizwhoop_the_post_thumbnail' );