0

I just want to ask this, since I viewed the page source of the homepage of a website created in wordpress, I saw a style tag on the body of the element, so I'm just wondering if its a default of wordpress or not, since I pretty much disabled / uninstalled or deactivated plugins and resort to the default theme, I think that this was coming from the wp_footer, so my question is. Is this a default on wordpress? or is there something causing it?

I was using this as an html validator >>> http://validator.w3.org/ and saw this http://prntscr.com/6daoxv

Hope someone can help me with this.

Thank you, thank you ~

  • Have you cleared all your caches? This has to be added by a theme or plugin and not Wordpress (if it is added by core, it is a bug and should be reported as such). Link tags outside the head tags is invalid HTML – Pieter Goosen Mar 6 '15 at 6:06
  • Thank you @Pieter Goosen Ok I'll try what you suggested. but it's not a link tag but a style tag. I apologize if I did a confusion there. – GreyWolfram Mar 6 '15 at 6:10
  • No, the style tag is fine, but look closely, there is a link tag in there that should not be there – Pieter Goosen Mar 6 '15 at 6:13
  • Ahh I see, this piece of code was the culprit >> add_action( 'wp_head', 'renderExternals'); I was adding the script on the wp_head, but I got a little confused there, it's supposed to go to wp_head but why did it go to wp_footer? do you have any idea why that happened? and one more thing, what do you mean by style tag is fine? is it ok if I put a style tag inside the body? thank you, thank you ~ – GreyWolfram Mar 6 '15 at 6:16
  • 1
    You should always use wp_enqueue_scripts to hook styles and scripts and adding them to the head or footer, do not add them directly to wp_head or wp_footer. Also, style tags are valid outside the head tags, BUT, you should avoid doing that. Inline styles are crappy to override by plugins and child themes and they are really frustrating. Keep styles in stylesheets, scripts in js files and use the wp_enqueue_*() and wp_register_*() funtions to enqueue/register styles and scripts and hook them to wp_enqueue_scripts – Pieter Goosen Mar 6 '15 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.