Yoast\WP\SEO\Helpers\Twitter

Image_Helper::get_by_id()publicYoast 1.0

Retrieves an image url by its id.

Метод класса: Image_Helper{}

Хуков нет.

Возвращает

Строку. The image url. Empty string if the attachment is not valid.

Использование

$Image_Helper = new Image_Helper();
$Image_Helper->get_by_id( $image_id );
$image_id(int) (обязательный)
The image id.

Код Image_Helper::get_by_id() Yoast 23.4

public function get_by_id( $image_id ) {
	if ( ! $this->image->is_valid_attachment( $image_id ) ) {
		return '';
	}

	return $this->image->get_attachment_image_source( $image_id, $this->get_image_size() );
}