_wp_post_thumbnail_class_filter()WP 2.9.0

Adds a 'wp-post-image' class to post thumbnails. Internal use only.

Uses the begin_fetch_post_thumbnail_html and end_fetch_post_thumbnail_html action hooks to dynamically add/remove itself so as to only filter post thumbnails.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

String[]. Modified array of attributes including the new 'wp-post-image' class.

Usage

_wp_post_thumbnail_class_filter( $attr );
$attr(string[]) (required)
Array of thumbnail attributes including src, class, alt, title, keyed by attribute name.

Changelog

Since 2.9.0 Introduced.

_wp_post_thumbnail_class_filter() code WP 6.4.3

function _wp_post_thumbnail_class_filter( $attr ) {
	$attr['class'] .= ' wp-post-image';
	return $attr;
}