Skip to content

Filters

chrisscott edited this page Sep 4, 2014 · 2 revisions

Filters

The following filters are provided.

mpt_unprotect_meta

Applying a filter to this and returning true (or anything that evaluates to true) will make the meta for storing thumbnails protected so it doesn't show in the Custom Fields metabox.

[post type]_[post id]_thumbnail_size

This filter is used to override the $size argument when MultiPostThumbnails::the_post_thumbnail() or MultiPostThumbnails::get_the_post_thumbnail() is called for the given [post type] and [post id]. Probably not very useful but provided to be consistent with WordPress' template tags of the same name.

[post type]_[thumbnail id]_thumbnail_html

This filter is used to override the thumbnail html (provided by WordPress' wp_get_attachment_image() function) returned/output when MultiPostThumbnails::the_post_thumbnail() or MultiPostThumbnails::get_the_post_thumbnail() is called for the given [post type] and [thumbnail id], where [thumbnail id] is the argument used when registering the thumbnail.

[post type]_[thumbnail id]_admin_post_thumbnail_html

This filter is similar to core's admin_post_thumbnail_html and can be used to override the HTML in the admin metabox for for the given [post type] and [thumbnail id], where [thumbnail id] is the argument used when registering the thumbnail.