Home › Forums › Pro Support › filter to alter output › Reply To: filter to alter output
August 26, 2020 at 2:46 pm
#18629
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.