• Hi,

    I have recently launched my new website. When I clicked to view the source code, I noticed there was a lot code that seemed “unnecessary” (I am unsure whether it is unnecessary or hidden on other WordPress websites that I’ve compared mine to).

    I was wondering if there is way to remove some of the information that is in the source code, and if yes, how do I do it? Ie.:
    – <link rel=”profile”
    – <link rel=”pingback”
    – <link rel=”shortcut icon”
    – A whole heap of <link rel=…>’s showing which plugins I use
    – A whole heap of <script type=’text/javascript…> codes
    – Some CDATA information such as “var servername” and “var options”
    – Some CSS information that is redundant on my site is also showing, ie. “<style type=”text/css”>”

    I tried using a source code cleanup plugin but it didn’t do anything other than compress all of the code into one large paragraph. Is there any other way to do this?

    Cheers.

Viewing 8 replies - 1 through 8 (of 8 total)
  • It is not unnecessary code.

    Try reducing the number of plugins you are using and then you can see which files are loading scripts and why.

    Thread Starter Lightpurple

    (@pamkaur14)

    Hi Mark,

    Thanks for your reply. Unfortunately, I cannot deactivate any plugins. I am running a fully operational website that I have launched to the public. Is there any other way to do it, such as inserting coding into the functions.php file to clean up the source code?
    Cheers.

    Can I ask why you feel the need to do this?
    There is nothing there added just because it can be – it is all needed.

    Thread Starter Lightpurple

    (@pamkaur14)

    The main lines I want removed are the ones that show which plugins I use on my site, ie. “<link rel=’stylesheet’….”. The reason why I want them removed is because my site is the first of its kind and I do not want to make it easy for anyone to duplicate it. With all of the plugins I use showing in the source code, anyone can replicate what I am doing in a matter of days.

    I understand the information is “needed”, but I do not understand how it doesn’t show on other websites that use WordPress. On other sites that I have visited, there is absolutely no information on the plugins they use. If it is really needed in the source code, how is it that I can’t see that information?

    hi pamkaur14,
    I’m wondering quite the same thing, did you find a solution about this?
    thank you in advance

    Thread Starter Lightpurple

    (@pamkaur14)

    No help whatsoever. Just someone who was more interested in wanting to know why I needed to do it.

    Moderator James Huff

    (@macmanx)

    The things you’re trying to remove, are *required* by the plugins you have decided to use.

    <link rel='stylesheet is what tells your browser how to find and load a required stylesheet. Stylesheets control the majority of how a website is rendered visually in your browser.

    Similar goes for <link rel='[anything] and most especially <script type='text/javascript which will be core functionality of your site and all of its elements.

    The source output is what your browser receives and then renders onto your screen. Mark is right, there is absolutely nothing extrenous that can be removed without affecting the operation or appearance of your site.

    If you don’t want these in your site, I encourage you to find an alternative in the over 37,000 free plugins at https://www.ads-software.com/plugins/ as maybe they function differently the current ones you’re using.

    jack randall

    (@theotherlebowski)

    it may not look pretty and you may not like the fact that people can see what plugins you have on the site but those lines of code are there for a reason: so the client browser knows what to fetch, from where and how to render it.

    not everything in life is pretty…

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WordPress Source Code Cleanup’ is closed to new replies.