• Hi

    When deciding where to place the icons I tried a few widget areas in my custom theme only to discover that even after removing the widgets the CSS styling remains in the head for the associated ID, despite it not being in use. i.e. below are styles relating to five unique IDs despite the fact I removed four of them and published my site. Surely these should be removed along with the icon widget? I could find and delete via wp_postmeta or options tables (I assume), but I’m not keen to delete from the database.

    <style type=”text/css” media=”screen”>#simple-social-icons-1 ul li a,#simple-social-icons-1 ul li a:hover{background-color:#141e28;border-radius:36px;color:#fff;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-1 ul li a:hover{background-color:#141e28;border-color:#fff;color:#fb2056}</style><style type=”text/css” media=”screen”>#simple-social-icons-2 ul li a,#simple-social-icons-2 ul li a:hover{background-color:#fff;border-radius:36px;color:#141e28;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-2 ul li a:hover{background-color:#fff;border-color:#fff;color:#fb2056}</style><style type=”text/css” media=”screen”>#simple-social-icons-3 ul li a,#simple-social-icons-3 ul li a:hover{background-color:#36f;border-radius:36px;color:#eee;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-3 ul li a:hover{background-color:#bbb;border-color:#fff;color:#fff}</style><style type=”text/css” media=”screen”>#simple-social-icons-5 ul li a,#simple-social-icons-5 ul li a:hover{background-color:#141e28;border-radius:36px;color:#fff;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-5 ul li a:hover{background-color:#141e28;border-color:#fff;color:#fb2056}</style>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter noddemix

    (@noddemix)

    Hi again

    I managed to resolve this with some careful editing in “wp_options”, the following tables: “sidebars_widgets” to remove inactive icons, and “widgets_simple_social_icons” to remove associated settings. Less than ideal though. Hopefully there are no other tables with associated data that I need to worry about?

    That should do it, yes.

    Thread Starter noddemix

    (@noddemix)

    Hi Andrea

    That did work but surely the plugin should remove any code inserted into the header associated with a widget that’s been deleted? Anyone who played around with different positions for the icons will have a big chunk of totally useless code at the head of every page on their site.

    From a performance/SEO point of view my main issue with WordPress is that WP/StudioPress and plugin developers never seem too concerned about code soup, erroneous code and bits of inline styling all over the place, which is why it can be so frustrating optimising a WP site.

    It should. If the plugin was deleted, then there wouldn’t be code injected into the head at all, because the code to do so would be removed.

    Was there caching running on the server?

    Thread Starter noddemix

    (@noddemix)

    Hi Andrea

    Thanks for replying.

    If I delete the plugin completely the code in the head is removed. Unfortunately the data remains in the database (‘widget_simple-social-icons’ table), so if I re-install the plugin then the old code that was inserted into the document head is inserted once again, despite the fact that all the associated widgets and inactive widgets have been deleted.

    So once you add an SSI widget anywhere on a site there’s no getting rid of the stylesheet in the head of the document if you then intend to delete that widget and add another. Despite deleting the plugin and reinstalling, and deleting all associated widgets/inactive widgets, if I add a single SSI widget to the foot of my page I now see this in the document source:

    <style type="text/css" media="screen">#simple-social-icons-1 ul li a,#simple-social-icons-1 ul li a:hover{background-color:#36f;border-radius:36px;color:#eee;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-1 ul li a:hover{background-color:#bbb;border-color:#fff;color:#fff}</style><style type="text/css" media="screen">#simple-social-icons-2 ul li a,#simple-social-icons-2 ul li a:hover{background-color:#fff;border-radius:36px;color:#1a2f47;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-2 ul li a:hover{background-color:#bbb;border-color:#fff;color:#fff}</style><style type="text/css" media="screen">#simple-social-icons-3 ul li a,#simple-social-icons-3 ul li a:hover{background-color:#fff;border-radius:36px;color:#1a2f47;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-3 ul li a:hover{background-color:#bbb;border-color:#fff;color:#fff}</style><style type="text/css" media="screen">#simple-social-icons-5 ul li a,#simple-social-icons-5 ul li a:hover{background-color:#fff;border-radius:36px;color:#1a2f47;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-5 ul li a:hover{background-color:#bbb;border-color:#fff;color:#fff}</style><style type="text/css" media="screen">#simple-social-icons-7 ul li a,#simple-social-icons-7 ul li a:hover{background-color:#fff;border-radius:36px;color:#1a2f47;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-7 ul li a:hover{background-color:#bbb;border-color:#fff;color:#fff}</style><style type="text/css" media="screen">#simple-social-icons-8 ul li a,#simple-social-icons-8 ul li a:hover{background-color:#fff;border-radius:36px;color:#1a2f47;border:0 #fff solid;font-size:18px;padding:9px}#simple-social-icons-8 ul li a:hover{background-color:#bbb;border-color:#fff;color:#fff}</style>

    As mentioned before, I’m able to rectify this by removing all references in ‘sidebars_widgets’ and the SSI table in the database, but this isn’t for the faint hearted.

    No cache – the code simply isn’t being removed from ‘widgets_simple-social-icons’.

    I tested on a fresh install to confirm.

    Plugin Contributor Nick C

    (@modernnerd)

    @noddemix Thank you for this report.

    If you delete the widgets, their content is removed from the widget_simple-social-icons row in the wp_options table.

    If you only move them to the inactive widget area, their settings are preserved in widget_simple-social-icons in case they are later restored.

    Likewise, if you deactivate or delete the plugin when there are Simple Social Icons widgets in the active or inactive widget area, those settings are currently preserved. It looks like there are two things we could improve here:

    1. Inline CSS for inactive widgets should not be output to the page as it currently is.
    2. If the plugin is deleted (rather than deactivated), widgets and the widget_simple-social-icons could be removed.

    I’ve opened issues for both of those suggestions here:

    https://github.com/copyblogger/simple-social-icons/issues/63
    https://github.com/copyblogger/simple-social-icons/issues/64

    Thank you again for taking the time to report this.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘CSS styling in head remains despite icon widget being removed’ is closed to new replies.