Created
November 10, 2017 18:52
-
-
Save robincornett/1fe6045b1acc64a329460e5c6023853e to your computer and use it in GitHub Desktop.
Code snippet to add a custom plugin icon to the WordPress plugins update page. Icons were added to this page in WordPress 4.9 and are automatically shown for plugins hosted in the WordPress repository, but not for plugins hosted/updated elsewhere.
This file contains hidden or 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
<?php | |
add_filter( 'all_plugins', 'prefix_add_plugin_icon' ); | |
/** | |
* Add a custom plugin icon to the plugins update page (introduced in WP4.9). | |
* | |
* @param $plugins | |
* | |
* @return mixed | |
*/ | |
function prefix_add_plugin_icon( $plugins ) { | |
$plugins['plugin-directory/plugin-directory.php']['icons']['default'] = plugin_dir_url( dirname( __FILE__ ) ) . 'css/images/icon.jpg'; | |
return $plugins; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment