Hi jfache,
Although it's been 10 months since you asked this question, you and others may still be interested.
The issue with your code is the get_post_meta filter accepts 4 arguments, which needs to be reflected in your code. The following code example should work if your theme supports Featured Images.
/* Description: Custom function to prevent post thumbnails from loading on search, category, and archive pages.
* @param string|array $metadata - Always null for post metadata.
* @param int $object_id - Post ID for post metadata
* @param string $meta_key - metadata key.
* @param bool $single - Indicates if processing only a single $metadata value or array of values.
* @return Original or Modified $metadata.
*/
function remove_post_thumbnail($metadata, $object_id, $meta_key, $single){
//Return false if the current filter is that of a post thumbnail. Otherwise, return the original $content value.
return ( isset($meta_key) && '_thumbnail_id' === $meta_key ) ? false : $metadata;
}
//Specify 4 arguments for this filter in the last parameter.
add_filter('get_post_metadata', 'remove_post_thumbnail', true, 4);
A good way to review how this works is reviewing the get_metadata() function in the /wp-includes/meta.php file.
Look for the apply_filters line:
$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
Notice the second parameter is null. This is the first parameter ($metadata) in the custom filter function: remove_post_thumbnail().
If the filter function returns anything other than null, the get_metadata() function will exit early. This is reflected in the conditional block immediately following the apply_filter() line.
Hope this helps.
David Carroll