Warning: This function has been deprecated. Use wp_get_attachment_image() instead.

get_attachment_innerHTML() WordPress Function

The get_attachment_innerHTML() function allows you to retrieve the contents of an attachment post in WordPress. This function is useful for displaying attachments in your theme.

get_attachment_innerHTML( int $id, bool $fullsize = false, array $max_dims = false ) #

Retrieve HTML content of image element.


Description

Top ↑

See also


Top ↑

Parameters

$id

(int)(Optional) Post ID.

$fullsize

(bool)(Optional) Whether to have full size image.

Default value: false

$max_dims

(array)(Optional) Dimensions of image.

Default value: false


Top ↑

Return

(string|false)


Top ↑

Source

File: wp-includes/deprecated.php

function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
	$id = (int) $id;
	if ( !$post = get_post($id) )
		return false;

	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
		return $innerHTML;

	$innerHTML = esc_attr($post->post_title);

	return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Use wp_get_attachment_image()
2.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More