Filter hook 'icon_dir'

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

View Source

icon_dir

Filter Hook
Description
Retrieve icon URL and Path.

Hook Information

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

Hook Parameters

Type Name Description
int $id Optional. Post ID.
bool $fullsize Optional. Whether to have full image. Default false.

Usage Examples

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

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

Source Code Context

wp-includes/deprecated.php:1917 - How this hook is used in WordPress core
<?php
1912  		$src_file = & $file;
1913  	} elseif ( $src = wp_mime_type_icon( $post->ID, '.svg' ) ) {
1914  		// No thumb, no image. We'll look for a mime-related icon instead.
1915  
1916  		/** This filter is documented in wp-includes/post.php */
1917  		$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
1918  		$src_file = $icon_dir . '/' . wp_basename($src);
1919  	}
1920  
1921  	if ( !isset($src) || !$src )
1922  		return false;

PHP Documentation

<?php
/**
 * Retrieve icon URL and Path.
 *
 * @since 2.1.0
 * @deprecated 2.5.0 Use wp_get_attachment_image_src()
 * @see wp_get_attachment_image_src()
 *
 * @param int  $id       Optional. Post ID.
 * @param bool $fullsize Optional. Whether to have full image. Default false.
 * @return array Icon URL and full path to file, respectively.
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/deprecated.php
Related Hooks

Related hooks will be displayed here in future updates.