Created
May 4, 2019 22:44
-
-
Save Pleiades/27bf1eddc73216f57e5ac9f3f39a928b to your computer and use it in GitHub Desktop.
Change the default icon directory in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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