函数原型
get_attachment_innerHTML( int $id, bool $fullsize = false, array $max_dims = false ): string|false
函数描述
Retrieve HTML content of image element.
是否弃用
Warning: This function has been deprecated. Use wp_get_attachment_image() instead.
函数参数
-
$id
int
Optional - Post ID.
-
$fullsize
bool
Optional - Whether to have full size image.
Default:
false -
$max_dims
array
Optional - Dimensions of image.
Default:
false
函数返回值
string|false
函数位置
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);
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.5.0 | Use wp_get_attachment_image() |
| 2.0.0 | Introduced. |

