1

I've tried to create a plugin icon for a plugin I have installed on several sites that I wrote, but is not hosted on Wordpress.org.

I've made icons as detailed in the Dev docs, but the icons do not show up and instead show this spanner icon.

enter image description here

I've placed the files in a /assets/ directory as per the dev docs. Any other ideas why this isn't working?

1 Answer 1

2

The dev docs are for adding an icon that the .org repository can use. You'll note that the relevant docs are part of the "The WordPress.org Plugin Directory" section.

To display an icon on the updates screen for a plugin that is not distributed through the repository you need to include the icon URL in the update data that WordPress receives when it checks for an update. WordPress looks for the icon in $plugin_data->update->icons[ $preferred_icon ], where $preferred_icon is the first of 'svg', '2x', '1x', 'default' that has a value.

This is how the data looks for Akiset, for example:

"akismet/akismet.php": {
    "id": "w.org/plugins/akismet",
    "slug": "akismet",
    "plugin": "akismet/akismet.php",
    "new_version": "4.1.11",
    "url": "https://wordpress.org/plugins/akismet/",
    "package": "https://downloads.wordpress.org/plugin/akismet.4.1.11.zip",
    "icons": {
        "2x": "https://ps.w.org/akismet/assets/icon-256x256.png?rev=969272",
        "1x": "https://ps.w.org/akismet/assets/icon-128x128.png?rev=969272"
    },
    "banners": {
        "1x": "https://ps.w.org/akismet/assets/banner-772x250.jpg?rev=479904"
    },
    "banners_rtl": [],
    "requires": "4.6",
    "tested": "5.8",
    "requires_php": false
}

Not knowing anything about how you are deploying updates, I can't say exactly what you'd need to change. If you're using a 3rd-party library you'd need to ask its author.

1
  • Thanks for this. I'm using an updater script I found for GitHub hosted repos, so I will try and find out from the origin about icons. But thanks for the detailed response.
    – Lee
    Aug 31, 2021 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.