We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support One more suggestion – post order Reply To: One more suggestion – post order

#10032
Tom
Keymaster

Those are the query args which don’t include the value for the featured image.

You need to filter the featured image directly, which is more complicated.

For example:

add_filter( 'post_thumbnail_html', function( $html, $post->ID, $post_thumbnail_id, $size, $attr ) {
    $custom_field = get_post_meta( get_the_ID(), 'your_custom_field', true );

    if ( '' == $html && $custom_field ) {
        $html = '<img src="' . $custom_field . '" alt="" />';
    }

    return $html;
}, 10, 5 );