WC_Regenerate_Images_Request::is_regeneratable()protectedWC 1.0

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.

Return

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() code WC 9.0.1

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;
}