Filter hook 'attachment_icon'

in WP Core File wp-includes/deprecated.php at line 1980

View Source

attachment_icon

Filter Hook
Description
Retrieve HTML content of icon attachment image element.

Hook Information

File Location wp-includes/deprecated.php View on GitHub
Hook Type Filter
Line Number 1980

Hook Parameters

Type Name Description
int $id Optional. Post ID.
bool $fullsize Optional. Whether to have full size image. Default false.
array $max_dims Optional. Dimensions of image.

Usage Examples

Basic Usage
<?php
// Hook into attachment_icon
add_filter('attachment_icon', 'my_custom_filter', 10, 3);

function my_custom_filter($id, $fullsize, $max_dims) {
    // Your custom filtering logic here
    return $id;
}

Source Code Context

wp-includes/deprecated.php:1980 - How this hook is used in WordPress core
<?php
1975  
1976  	$post_title = esc_attr($post->post_title);
1977  
1978  	$icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
1979  
1980  	return apply_filters( 'attachment_icon', $icon, $post->ID );
1981  }
1982  
1983  /**
1984   * Retrieve HTML content of image element.
1985   *

PHP Documentation

<?php
/**
 * Retrieve HTML content of icon attachment image element.
 *
 * @since 2.0.0
 * @deprecated 2.5.0 Use wp_get_attachment_image()
 * @see wp_get_attachment_image()
 *
 * @param int   $id       Optional. Post ID.
 * @param bool  $fullsize Optional. Whether to have full size image. Default false.
 * @param array $max_dims Optional. Dimensions of image.
 * @return string|false HTML content.
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/deprecated.php
Related Hooks

Related hooks will be displayed here in future updates.