Support » Requests and Feedback » Search widget does not validate (XHTML/W3C)

  • hello,
    if you use the Search widget, you’ll find out that the page won’t validate in XHTML.
    the culprit is: role=”search”
    I deleted it from general-template.php and everything seems to work smoothly, the search appears to work OK and the page now validates.
    I hope this is useful and that it will be fixed, please tell me if I screwed up something instead. 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • I found this issue as well, thanks for letting me know which core file to tweak to fix it. I did some more research, though, and it looks like “role” will be a valid attribute in XHTML 2. Since we can’t even validate XHTML 2 yet, though, I’m wondering if there’s a better way to fix this in the short run …

    nice find! maybe the WP team could comment-out “role” or sorting something out while we wait for XHTML 2 (for a long time, I assume).
    I’d also like to know what is the purpose of the role=”search” string, because as I said it seems everything is working just fine without it.

    Demetris, that’s just fine for accessibility, but it’s not valid markup at the moment. With clients who demand validated website scripts it makes it very difficult to “sell” WordPress as a long-term CMS solution. If roles remain in core, then the automatic update feature will un-do any hardcode editing we do to force WP to validate.


    Yes, I know. 🙂

    It’s also a known issue at the development tracker, and there is also an open ticket against the current branch (2.8).

    It seems that, for now, the only solution is not to use the default search widget or the get_search_form() function, which—when there is no searchform.php template in the active theme’s directory—generates the accessible but invalid code.

    Will i screw anything up if i remove the role attribute in the general-template.php file under the get_search_form() function?


    maybe i’m a bit late in reply, but i’ve target the validation issue in a cleaner way than editing the core file by simply adding a filter to my function.php file.
    Here are details.

    Hope this can be usefull.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search widget does not validate (XHTML/W3C)’ is closed to new replies.