Support » Themes and Templates » Search Template Tag / Strict

  • I’ve a problem with the search template tag (<?php get_search_form(); ?>). Validator says: “document type does not allow element “label” here” (xhtml 1.0 strict).

    Where can I edit the output of the Search template Tag (<?php get_search_form(); ?>)?

    I tried to set the Tag in a <p> tag, but it was not the solution.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Jan Dembowski


    Brute Squad and Volunteer Moderator

    Can you provide a link? That we we can see the output and see what and if you are wrapping the search box output on.

    Sorry, can’t delete the htacces, isn’t my webspace.

    Line 41, Column 30: document type does not allow element “label” here; missing one of “p”, “h1”, “h2”, “h3”, “h4”, “h5”, “h6”, “div”, “pre”, “address”, “fieldset”, “ins”, “del” start-tag .

    <label for=”s” class=”hidden”>Search for:</label>


    The mentioned element is not allowed to appear in the context in which you’ve placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you’ve forgotten to close a previous element.

    One possible cause for this message is that you have attempted to put a block-level element (such as “<p>” or “<table>”) inside an inline element (such as ““, “<span>”, or “<font>”).

    Output of Search looks so:

    # <form action="" id="searchform" method="get">
    # <label for="s" class="hidden">Search for:</label>
    # <div><input type="text" id="s" name="s" value=""/>
    # <input type="submit" value="Search" id="searchsubmit"/>
    # </div>
    # </form>

    So i have to set a paragraph between <form…. and </form>

    So i have to know where the search Tag get generated. Which File?


    No idea? It can not be possible that no one ever got into with the search widget.

    All what I want to know is, where the stuff for the search widget is located.

    I’ll bump this – I’m looking for the exact same thing.

    Same here…

    Hi it’s in wp-includes/general-template.php

    let me know if you have more questions.

    You can put your own searchform.php file in your theme and override this, or even more simply, someone at WordPress could fix this by moving the div tag above the label tag.

    It doesn’t seem to change the appearance at all, and this makes it XHTML 1.0 Strict compliant.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search Template Tag / Strict’ is closed to new replies.