WordPress XHTML validator

WordPress XHTML validator in action

Have you noticed how hard it is to keep your blog compliant with standards? Through the WordPress XHTML validator, getting to comply, staying compliant, having valid HTML in your WordPress blog and going Section 508 is a breeze.

This tool is also bundled with Turbocharged for WordPress. Need support? Buy it and get other plugins, themes and support for free.

The WordPress XHTML validator analyzes and validates your entire weblog, and then shows you a list of invalid entries, explaining why each one is invalid and offering valid replacements. The analysis process is very fast: analyzing a weblog with over 400 posts and 2000 comments takes less than one minute.

Hey, you! Yes, you! Did you like this plugin? Want to help WordPress users get Truly Valid? Spend 60 seconds joining the Truly Valid campaign and help make the Web a better place!

This plugin will automatically validate any post or page you edit, notifying you of any validation issues.

This plugin also latches itself onto the Manage section of the WordPress administrative interface, and, when invoked, scans all posts, pages and comments, validating each one.

It requires xmllint or tidy, which do the heavy lifting, installed on your Web hosting server.

To use:

  • ensure the server has the xmllint or `tidy` commands installed (having both is doubleplusgood!)
  • install and activate the plugin
  • access the Manage panel in the WordPress administrative interface
  • click on the XHTML validation tab

This plugin is now fully compatible with WordPress 2.1.

Download the WordPress XHTML validator now!

Getting help

Help for this software is available in several forms. Here are the rules:

  • E-mails or posted comments with bug reports, patches, suggestions or contributions of any kind will be received by me in good faith, and I will, in time, incorporate all submitted improvements, in any form, to the software.
  • This software is delivered to you without warranty of any kind, as recognized by the GNU General Public License.
  • Special requests, such as customization, third-party licenses, development of large features, or requests which require software engineering to be applied, will be performed by me, for a fee. If you’re attracted to my engineering skills, wait until you see my rates. After all, living on a Third World country has its advantages. Let me know if you’re interested.

Share this article!

Sound off!

Write your own

Opinions

  1. Rudd-O Says:

    By the way, yes, I am aware that this page does not validate. Validation performed by the WordPress XHTML validator is reserved for post content only.

    Of course, I’ll fix this as soon as I get somewhere where outgoing SSH access is not firewalled.

  2. Blogging Pro China » Blog Archive » WordPress Plugin: XHTML validator Says:

    […]   XHTML validator,用于验证你的文章是否符合XHTML标准。 XHTML […]

  3. James Says:

    Great plugin that worked at one point of time - now all of a sudden it isn’t working… Saying “Your Web hosting server does not have xmllint installed. Please install it or have the administrator install it for you, then try again.”

    The weird part is if I open up shell and execute xmllint it pulls it up, so it is on the server… and the plugin was working previously. Any ideas on what could cause this ?

  4. Rudd-O Says:

    I honestly wouldn’t know. But I can tell you this: the plugin checks for xmllint, by executing it. If the return value is == 127, then you get the message. So you might want to investigate whether it’s because your PHP setup does not let external commands execute, or maybe because xmllint isn’t located in the PHP’s execution $PATH.

  5. Claire Says:

    I got this error after clicking on “validate my content now.” What does it mean?

    Warning: proc_open() has been disabled for security reasons in .../wp-content/plugins/wp-validator/wp-validator.php on line 153
    Failed to run xmllint

  6. Rudd-O Says:

    it means you do not have access to using a function required by xhtml validator

    talk to your server admin

  7. Nath Says:

    I set this running about ten minutes ago and it says it is still loading… is that a reasonable thing to expect from this or is that not normal?

    Btw I don’t actually have many posts on my site - probably less than 50.

    Am guessing it might be an issue with memory allocation but it isn’t throwing an error yet…

  8. Rudd-O Says:

    No errors will be shown onscreen. You need to check your server logs, if your browser’s animated throbber stops.

  9. Nath Says:

    I am getting the error:

    failed_auth.html
    sh: line 1: xmllint: command not found

    I thought that it didn’t require both xmllint and tidy? My server has tidy on it but not xmllint, is there a workaround?

    Thanks
    Nath

  10. Rudd-O Says:

    I’ll look into it this weekend.

  11. Matt Bramanti Says:

    The validator hangs at 748 out of 1771 entries. Any idea why? I’ve increased max execution time to 60 seconds, and I’ve increased max memory usage to 16M, but the thing still hangs at 748.

    Any help would be appreciated.

  12. Computer Guru Says:

    Hi,
    I just installed this plugin on my server, I have xmllint installed, but I don’t have Tidy.
    It runs and returns ~60 invalid posts, but the “Quick Fix” column only has “Do not fix” available.
    Is this because I don’t have tidy installed? Will installing it take care of that issue?

    Thank you,
    CG

  13. Rudd-O Says:

    Indeed, it’s tidy who provides the quick fix functionality. Installing it should take care of this issue.

  14. Computer Guru Says:

    Thanks a lot Rudd-O, it works like a dream, and now my entire blog is Valid XHTML….
    However, I have about twenty “A plugin is damaging the comment” or “A plugin is damaging the content”

    I don’t have any markup plug-ins….

  15. spellmank Says:

    Hi,

    My web host has never heard of xmllint so could not install it. Any suggestions on how I can explian where to get and install it?

    Thanks,
    spellmank

  16. Anonymous Says:

    foo

  17. Zechs Says:

    Hi,

    I have apache 2.0.58, php 5.1.3 and wordpress 2.0.2 installed on my computer running Windows XP SP2.
    Before I found your plugin today, I used validator page from W3C (http://validator.w3.org/) to validate my pages.
    Cygwin was installed to obtain xmllint, tidy and nice used in the plugin.
    I can use xmllint and tidy to validate xhtml files in command line.
    However, if I use the plugin to validate xhtml files, it will stop at “processing entry 0 …” and make no progress.
    Finally, I found there were infinite loops in the while loops of function run_content_through_xmllint and run_content_through_tidy.
    Thus I replace both while loops with the following:

    $stdout = stream_get_contents($pipes[1]);
    fclose($pipes[1]);

    $stderr = stream_get_contents($pipes[2]);
    fclose($pipes[2]);

    proc_close($process);

    Now, it works fine for me.

  18. Rudd-O Says:

    Thanks so much for this. Can you please send me your plugin .php file attached? That is so I can run kompare on mine and yours, and visually see the problem.

    Have a great day, Zechs!

  19. Brian Dowd Says:

    When attempting to run the XHTML validator I get the following;

    Validate all content

    Warning: Invalid argument supplied for foreach() in /home/brian/public_html/wordpress/wp-content/plugins/wp-validator.php on line 571
    The process is finished. Here’s a report of what WordPress XHTML validator found.

    (followed by warnings about invalid XHTML in the title and the content of all the posts).

    What does the error mean, how can it be corrected and what does that tell me about the posts?

    Many thanks.

  20. Rudd-O Says:

    Brian, can I ask you a question?

    Does your blog have any comments (not marked as spam, of course)?

    I need to know in order to fix this.

  21. Computer Guru Says:

    Would it be possible to make the next release able to automagically do the work in chunks? i.e. scan the first 500, then the next 500, etc. because there are a lot of people that can’t change the max_execution_time in their PHP settings.

    Regards,
    `CG

  22. Velanche Says:

    Hi There:
    Just installed the plugin and want to test it a bit.

    After activating the plugin, I’ve clicked on the Manage window, and ended up with this message at the top of my browser window…

    Warning: file_get_contents(/home/u2/urbanl/html/wordpress/wp-content/plugins/entity-manifest.txt): failed to open stream: No such file or directory in /home/u2/urbanl/html/wordpress/wp-content/plugins/wp-validator.php on line 50

    Upon checking the script (and I should add that I’m not a coder), there’s an entry for the entity-manifest.txt file. Yet the README file states that all I should have to load is the main php file.

    Can you please clarify if the manifest file needs to go there, and if not what do I need to do to keep the error message from repeating. Thanks much!

  23. Velanche Says:

    Nevermind…guess it needed to be there so that it can be seen when I click on XHTML Validator tab. Thanks, anyways….testing now.

  24. Michael Vail Says:

    Hello
    I have xmllint on my machine
    but when I activate your plugin my blog shows a blank page and
    when I rm it, it comes back

    in php.ini I have memory use up to 64meg

  25. Murat Says:

    hello all. thanks for mod.
    But
    click to plugin activate link:

    Warning: exec() has been disabled for security reasons in /var/www/vhosts/mysiteadress.net/httpdocs/blog/wp-content/plugins/wp-validator.php on line 126

    Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/mysiteadress.net/httpdocs/blog/wp-content/plugins/wp-validator.php:126) in /var/www/vhosts/mysiteadress.net/httpdocs/blog/wp-includes/pluggable-functions.php on line 272

  26. Rudd-O Says:

    The exec() thing is not a bug. Google for the words and you’ll find the answer you’re looking for

  27. mulder Says:

    When I start the validation, I get the message validating 65 of 89 posts. But then it stops there, nothign happens, no error nothing.pl. help.

    http://img131.imageshack.us/img131/1575/clipboard01pe4.jpg

  28. Meredith Says:

    I’m trying to use the validator for approximately 10,000 entries. (I assume that is posts + comments, as I only have about 3,500 posts.) It seems to break horribly no matter what I do…extending max_execution_time doesn’t seem to work. In fact, I was only able to get that partial completion result when I had no PHP modifications in place…when they are there, it just goes on and on endlessly.

    Any suggestions on perhaps breaking up the process?

  29. THM Says:

    Perfect ;)

  30. 注册公司 Says:

    很不错的站,学习了.严重感谢
    急需高手指点一下怎样设计wordpress.我也想设计成这样的风格了。
    http://www.wfoe.cn

  31. fizik Says:

    hello all. thanks for mod. :)

  32. Michael Says:

    thanks a bunch for this little plugin, appears on my “must-have” list ;-)

    cheers,
    michael

  33. Pallab Says:

    I get the error :

    Fatal error: Unsupported operand types in on line 565

  34. Ed Cooper Says:

    Hi, I’ve installed and set everything correctly and changed my max exec and memory higher but i’m getting this error…
    Fatal error: Unsupported operand types in /home/coop/public_html/wp-content/plugins/wp-validator/wp-validator.php on line 572
    Any idea? There is nothing even on that line in the php file the last command was…
    get_currentuserinfo();
    Cheers,
    Ed

  35. Miral Says:

    Whenever I activate this plugin (WP 2.2), the browser hangs whenever I go to edit an existing lengthy post. (New posts are unaffected, as are really short posts.)

  36. Brian Says:

    Hi-

    I’m having the same problem as others. The error I’m getting reads:

    Fatal error: Unsupported operand types in /home/marat2/public_html/brianpeppler/wp-content/plugins/wp-validator.php on line 565

    This looks like a great plugin; I’m looking forward to using it!

  37. Rudd-O Says:

    Please upgrade to the latest PHP5. Or attempt to find a workaround, send it and I’ll distribute it in future versions.

  38. Scott Carpenter Says:

    Great plugin! This is just the thing I’ve been looking for. Thank you.

  39. kalakaua Says:

    Dude, this page http://rudd-o.com/projects/wp-validator/ has Failed validation with 26 Errors. I’m having the same trouble on my WP. Is it still usefull to insall ur Plugin?

  40. Jacob Wintersmith Says:

    I’m using WP 2.3.3; when the plugin is active, I cannot edit old posts. When I click a link to edit a post, my browser just hangs and never actually loads the edit-post page.

  41. David Gingrich Says:

    Jacob: I had the same problem with a few posts and fixed it by adding a call to stream_set_blocking in run_content_through_tidy. For some reason tidy would occasionally block stderr. I am running on Dreamhost. You can get the patch, a fresh version of wp-validate.php and some information on my blog: Fixing a glitch in wp-validator.

    Rudd-O: please feel free to grab the code and integrate it. I revved the version number and added a comment to the description so I would remember the change on later releases. You’ll probably want to remove those if you integrate the changes. Let me know if you need more details about my environment.

  42. David Gingrich Says:

    Oops, accidentally linked to the front-page. Here’s the permalink: Fixing a glitch in wp-validator.