Forums

Chaning media library file icons (1 post)

  1. richieitchy
    Member
    Posted 3 months ago #

    I have moved and then upgraded a website to WP3.3.1. Within the website there is a plugin written by a third party, who, I can no longer contact.

    The plugin does several things, amongst which, changes the default icon for files within the medial library from the document.png icon (contained in wp-includes/images/crystal) to another image located within the theme directory. The code within the plugin is

    add_filter('wp_mime_type_icon', 'icon_change');
    
    function icon_change($icon, $mime = NULL, $post_id = NULL) {
        return get_theme_root_uri() . '/theme_directory/images/new_doc.png';
    }

    I have added the = NULL value to the 'mime' and 'post_id' variables, as I noticed sometime after the upgrade I was getting an error stating the code was expecting values, but as being passed none, and this fixed it.

    Currently with this code in place noting is returned. If I remove it the default WP icons appear.

    Can anyone confirm this code is still valid, I have checked using an echo statement that a valid url is returned/created, which it is.

    Any help would be greatly appriciated.

    Thanks

Reply

You must log in to post.

About this Topic