Skip to content

Instantly share code, notes, and snippets.

@Pleiades
Created May 4, 2019 22:44
Show Gist options
  • Save Pleiades/27bf1eddc73216f57e5ac9f3f39a928b to your computer and use it in GitHub Desktop.
Save Pleiades/27bf1eddc73216f57e5ac9f3f39a928b to your computer and use it in GitHub Desktop.
Change the default icon directory in WordPress
/*
* Replaces the default media-type icon library in wp-includes/images/crystal with wp-content/themes/{theme-name}/images/
* WordPress default media types include archive, audio, code, document, interactive, spreadsheet, text, and video.
*
*/
add_filter( 'icon_dir', 'wpdocs_theme_icon_directory' );
add_filter( 'icon_dir_uri', 'wpdocs_theme_icon_uri' );
/*
* Return my desired icon directory
*/
function wpdocs_theme_icon_directory( $icon_dir ) {
return get_stylesheet_directory() . '/images';
}
/*
* Return my desired icon URI
*/
function wpdocs_theme_icon_uri( $icon_dir ) {
return get_stylesheet_directory_uri() . '/images';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment