Custom_Image_Header::get_previous_crop()
最后更新于:2021-11-25 19:44:42
Custom_Image_Header::get_previous_crop( array$object)Get the ID of a previous crop from the same base image.
参数
- $object
-
(array) (Required) A crop attachment object.
响应
(int|false) An attachment ID if one exists. False if none.
源文件
文件: gc-admin/includes/class-custom-image-header.php
public function get_previous_crop( $object ) {
$header_images = $this->get_uploaded_header_images();
// Bail early if there are no header images.
if ( empty( $header_images ) ) {
return false;
}
$previous = false;
foreach ( $header_images as $image ) {
if ( $image['attachment_parent'] === $object['post_parent'] ) {
$previous = $image['attachment_id'];
break;
}
}
return $previous;
}