Custom_Image_Header::get_previous_crop

Advertisement

Summery Summery

Get the ID of a previous crop from the same base image.

Syntax Syntax

Custom_Image_Header::get_previous_crop( array $object )

Parameters Parameters

$object

(array) (Required) A crop attachment object.

Return Return

(int|false) An attachment ID if one exists. False if none.

Source Source

File: wp-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;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
4.9.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.