On this page
get_attachment_innerHTML( int $id, bool $fullsize = false, array $max_dims = false ): string|false
This function has been deprecated. Use wp_get_attachment_image() instead.
Retrieve HTML content of image element.
Description
See also
Parameters
$idint Optional-
Post ID.
$fullsizebool Optional-
Whether to have full size image.
Default:
false $max_dimsarray Optional-
Dimensions of image.
Default:
false
Return
string|false
Source
File: wp-includes/deprecated.php. View all references
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);
}
Related
Uses
| Uses | Description |
|---|---|
| get_attachment_icon() wp-includes/deprecated.php | Retrieve HTML content of icon attachment image element. |
| esc_attr() wp-includes/formatting.php | Escaping for HTML attributes. |
| _deprecated_function() wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| get_post() wp-includes/post.php | Retrieves post data given a post ID or post object. |
Used By
| Used By | Description |
|---|---|
| get_the_attachment_link() wp-includes/deprecated.php | Retrieve HTML content of attachment image with link. |
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Use wp_get_attachment_image() |
| 2.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_attachment_innerhtml