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


Hello again,
Well, nice try, Thanks. I’ve been playing a while and found a couple of things:
One: your code had two errors. The working one (errors in bold) is this:

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

function tu_override_featured_image_id( $metadata, $object_id, $meta_key, $single ) {

	if ( isset( $meta_key ) && '<strong>_thumbnail_id</strong>' == $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( <strong>'get_post_metadata'</strong>, 'getqtlangcustomfieldvalue', 100, 4 );

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

	return $metadata;

Two: Actually, this changes the featured image everywhere, while I need to swap it only in the «index» pages as in here:
and in here ( which is the place I can’t… 😀 )
You can see the different thumbnails in the post ‘«Ferro i cànem» de Paco Ferrando‘.
Any further idea?
Again, thanks for your interest, Tom.