generate_featured_image_output

The generate_featured_image_output allows us to alter the HTML of the featured image on the posts/blog page.

Example

If we don’t want a link surrounding the featured image:

add_filter( 'generate_featured_image_output', function( $output ) {
    return sprintf( // WPCS: XSS ok.
        '<div class="post-image">
                %2$s
         </div>',
         esc_url( get_permalink() ),
         get_the_post_thumbnail(
             get_the_ID(),
             apply_filters( 'generate_page_header_default_size', 'full' ),
             array(
                 'itemprop' => 'image',
             )
         )
    );
} );