WC_Regenerate_Images_Request::is_regeneratable
Determines whether an attachment can have its thumbnails regenerated.
Adapted from Regenerate Thumbnails by Alex Mills.
Method of the class: WC_Regenerate_Images_Request{}
No Hooks.
Returns
true|false. Whether the given attachment can have its thumbnails regenerated.
Usage
// protected - for code of main (parent) or child class $result = $this->is_regeneratable( $attachment );
- $attachment(WP_Post) (required)
- An attachment's post object.
WC_Regenerate_Images_Request::is_regeneratable() WC Regenerate Images Request::is regeneratable code WC 10.7.0
protected function is_regeneratable( $attachment ) {
if ( 'site-icon' === get_post_meta( $attachment->ID, '_wp_attachment_context', true ) ) {
return false;
}
if ( wp_attachment_is_image( $attachment ) ) {
return true;
}
return false;
}