• Skip to content
  • Skip to primary sidebar
  • Skip to footer

Foliovision

Main navigation

  • Weblog
    • FV Player
    • WordPress
    • Video of the Week
    • Case Studies
    • Business
  • About
    • Testimonials
    • Meet the Team
    • We Support
    • Careers
    • Contact
    • Pricing
  • Products
  • Support
    • FV Player Docs
    • Pro Support
  • Login
  • Basket is empty
Affordable VAST/VPAID for Wordpress has arrived. Serve ads with your videos starting today!

Why WordPress won’t validate

14 October 2009 / Martin / Leave a Comment

We recently checked our site in W3C Markup Validation Service and find out that some of our inline javascript in the posts is not properly enclosed in CDATA tags. Read about the details of the issue, reason for it and a bit of hope in future WordPress releases.

Everything inside a CDATA section is ignored by the XML parser and all the inline javascript should be in it. This is how you do it:
 

<script>
<![CDATA<strong>[ </strong>function anything(a,b)
{ }
]]>
</script>

So we fixed all of our plugins which are putting any javascript into the posts and there was another error coming out of the Validation Service saying that the CDATA section is not properly closed.

The generated source code of the page was looking like this:
 

<script>
<![CDATA[
function anything(a,b)
{ }
]]&gt;
</script>

The greater than symbol in CDATA closing tag was replaced by the HTML entity.

We disable both wpautop (this is a function which is automatically inserting paragraphs and newlines into the post – that’s why we hate the default WordPress editor which can’t live without it and use Foliopress WYSIWYG instead) and wptexturize (another nice WordPress function, which used to mess up all of our HTML comments) all the time, so we were very unhappy that there is some other plugin destroying our posts.

After a while I discovered that it’s the WordPress core who is doing this. Let’s take a peek at the structure of the responsible WordPress template tag code:
 

function the_content() {
    1. Get the post content;
    2. Apply all the filters on it;
    3. Replace ]]> with ]]&gt;
    4. Display it;
}

So there’s an extra line of code just to mess the CDATA tags. No php comments around it to explain why it’s there. Nothing in the WordPress Codex about it, no sensible answers in support forums.

I had to search the WordPress bug tracking system for an hour to find more about the problem: That single line of code is there for RSS. CDATA closing tag would just break the feeds. That’s is.

Seems like the WordPress guys are aware of this as the issue is planed to be solved for WordPress 2.9 – https://core.trac.wordpress.org/ticket/3670. That means the tag will be converted only in the feeds. Until then our pages are not 100% valid.

However the ticket is 5 years old now with last change 5 weeks ago. I can’t believe WordPress community is fighting this nearly from the beginnings of WordPress.

  • Read more about CDATA on w3schools or Wikipedia.
  • Read about problems people have with this WordPress issue.
  • Take a look at the fix.
Martin Vicenik

Martin Viceník

Martin graduated as an engineer in Computer Science from Slovak Technical University in Bratislava. He grew up in Liptovský Mikuláš in northern Slovakia next to the beautiful Tatra mountains. He is the developer behind our FV Player.

Categories: WordPress

Related Posts

  1. How to Comment Code in WordPress Templates

    How to Comment Code in WordPress Templates

  2. FV Testimonials: Embedding

    FV Testimonials: Embedding

  3. FV Testimonials: Guide to Templates – old

    FV Testimonials: Guide to Templates – old

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You can click here to Subscribe without commenting

Primary Sidebar

Categories

  • Business
  • Camera Reviews
  • Case Studies
  • Design
  • FV Player
  • Internet Marketing
  • IT
  • Life
  • SEO
  • Slovak
  • Video of the Week
  • WordPress

Footer

Our Plugins

  • FV WordPress Flowplayer
  • FV Thoughtful Comments
  • FV Simpler SEO
  • FV Antispam
  • FV Gravatar Cache
  • FV Testimonials

Free Tools

  • Pandoc Online
  • Article spinner
  • WordPress Password Finder
  • Delete LinkedIn Account
  • Responsive Design Calculator
Foliovision logo
All materials © 2025 Foliovision s.r.o. | Panská 12 - 81101 Bratislava - Slovakia | info@foliovision.com
  • This Site Uses Cookies
  • Privacy Policy
  • Terms of Service
  • Site Map
  • Contact
  • Tel. ‭+421 2/5292 0086‬

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in .

Powered by  GDPR Cookie Compliance
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Necessary Cookies

Strictly Necessary Cookie allow you to log in and download your software or post to forums.

We use the WordPress login cookie and the session cookie.

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

Support Cookies

Foliovision.com uses self-hosted Rocket.chat and self-hosted Freescout support desk to provide support for FV Player users. These cookies allow our visitors to chat with us and/or submit support tickets.

We are delighted to recommend self-hosted Rocket.chat and especially Freescout to other privacy-conscious independent publishers who would prefer to self-host support.

Please enable Strictly Necessary Cookies first so that we can save your preferences!

3rd Party Cookies

This website uses Google Analytics and Statcounter to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping this cookie enabled helps us to improve our website.

We reluctantly use Google Analytics as it helps us to test FV Player against popular Google Analytics features. Feel free to turn off these cookies if they make you feel uncomfortable.

Statcounter is an independent Irish stats service which we have been using since the beginning of recorded time, sixteen years ago.

Please enable Strictly Necessary Cookies first so that we can save your preferences!