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 filter to alter output Reply To: filter to alter output

#18629
Tom
Keymaster

You may be able to filter the WordPress featured image ID before it ever reaches the plugin or theme:

add_filter( 'get_post_metadata', 'tu_override_featured_image_id', 100, 4 );

function tu_override_featured_image_id( $metadata, $object_id, $meta_key, $single ) {
    if ( isset( $meta_key ) && 'thumbnail_id' == $meta_key ){
        remove_filter( 'get_post_metadata', 'tu_override_featured_image_id', 100 );
        $new_id = get_post_meta( $object_id, 'imatge_destacada_alternativa', true ) ;
        add_filter( 'tu_override_featured_image_id', 'getqtlangcustomfieldvalue', 100, 4 );

        if ( $new_id ) {
            $metadata = $new_id;
        }
    }

    return $metadata;
}

Not sure if it will work, but worth a shot.