Skip to content

Instantly share code, notes, and snippets.

@robincornett
Created November 10, 2017 18:52
Show Gist options
  • Save robincornett/1fe6045b1acc64a329460e5c6023853e to your computer and use it in GitHub Desktop.
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.
<?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