Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My site is throwing up a few errors typically due to trailing slashes being added.

eg. wordpress is adding in:

<meta name='robots' content='noindex,nofollow' />

my doctype is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

If my understanding is correct the validator is seeing those trailing slashes as being xhtml but is getting worried as the doc type doesn't state it.

I don't want it to be an xhtml doctype as that causes me lots of other problems.

My code is fine but its bits like that meta tag that wordpress is putting in that is causing the problem. How do I solve this?

the trailing slash is making the validator think things are closing so its then throwing up errors on stupid stuff like my closing head and opening body tags.

share|improve this question
add comment

1 Answer

Use a HTML5 document declaration:

<!Doctype html>

XML self closing slashes are allowed in HTML5.

In an attempt to turn this into a WordPress question (really, it isn’t): WordPress spits out hard coded XHTML style in many places. Since most people will not send real XHTML, HTML5 is the best option to deal with WordPress’ legacy code while keep validating markup.

share|improve this answer
    
thanks but sadly a decision was made to not make the site html5 for various reasons so I cant really go down that route. surely it is a valid question though as it is wordpress that is generating the slashes that are upsetting the validator. i know it wont actually affect how the site works but it would be nice to get it to validate. many thanks though! –  James Olney Feb 22 '12 at 12:07
1  
You don’t need any further changes, just the doctype. –  toscho Feb 22 '12 at 12:09
    
just tried it out of curiousity and it threw up more errors due to things that it wants tackled in css instead which right now is more work than i have time for. thanks anyway - i suspect i may have to live with the errors until i can do a re-write. –  James Olney Feb 22 '12 at 12:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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