Support » Fixing WordPress » Odd Validation Error in list_cats tag

  • I’m getting a very strange validation error generated by my list_cats tag. It doesn’t appear on the HTML source page so it is something being “found” by the W3C validator.

    ....Thoughts on Life" href="index.php?cat=7&PHPSESSID=

    The template tag used is:

    <?php list_cats(FALSE, '', 'ID',
    'asc', '', FALSE, FALSE,
    '', '', '1,33',
    TRUE); ?>

    Since I can’t find it on my source page, I think this is very odd.

    Anyone familiar with this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • I just ran it through the W3C validator and it gave me this error:

    Please, validate your XML document first!
    Line 597
    Column 83
    The reference to entity "PHPSESSID" must end with the ';' delimiter.

    The tag ends with the ; and it’s copied out of the codex. Hmmm.


    You’re in luck. It sounds like the validation error on the search form. If it is, I just posted a workaround:

    Note that the second workaround has the additional virtue that it’s dangerous! 😉

    This is serious stuff. Few questions – and I post them here and not in the article because they apply to WordPress issues.

    * What is it about the plugins that trigger these if it is the search form that is the culprit to begin with? Why would it matter?

    * How will I know which plugins use session tags? Is there a way to tell in the code or maybe we should start advising plugin authors to warn us or make a workaround.

    With nothing changed, all my plugins still active, I switched to Kubrick Theme and I don’t get the error —- oh, most of my plugins have to be “put” into the index.php, sdiebar.php, etc., before they are active. Well, I put two plugin references and the list categories template tag to run a test on it, since Default Theme validates. Bingo, there is the error.

    The only change I made was to add the following:
    – wp_list_cats
    – Coffee2Codes Custom Posts
    – Andreas Holstenson’s Related Links

    So I eliminated them one by one and isolated the error in the WordPress tag wp_list_cats. My first error isolated it to the wp_list_cats but I have no plugins set in the Default Theme now on my test. I can go through and turn off the plugins one by one, but I don’t have any call-outs to plugins in my test Theme.

    OH, wise one who is saving me here, now what?

    And I assume you’ve reported this to the mosquito catchers?

    Well, it’s not like this is a bug (I’m replying as though I were a “wise one, which is a bit of a hoot, but anyway). PHP’s rewrite engine is doing just what it’s supposed to be doing: when you’re doing sessions, you need to pass session IDs around.

    The way I found the session stuff was to grep on “session” in the plugin directories. Here’s a line in stattraq.php that seems to be up to no good:


    Btw, I had erroneously fingered Theme Switcher, which does not use sessions. I’ve corrected it on my blogsite.

    It is a bug if it effects EVERY user and the integration of Plugins. Plugin authors have to be notified, a lot has to happen to fix this. I’ve let a few people know, but it would help a lot, since you understand words like grep (see, you is wise one) and I haven’t a clue what that is, to post a note on the bug reports… should be the site.

    When the WordPress developers make their claim that the site validates, and then encourage plugins which invalidate…see, this is a little on the important side.

    Thanks so much. I’ve been fighting this for several days without an answer. You life saver and wise one.

    Okay, I’m even more confused. This error doesn’t come from WordPress, I’ve learned. It is a known bug in PHP. According to what I’ve been told, plugins that use PHP “sessions” activate this bug which causes a page not to validate. I’ve been told that WordPress is written as to NOT use PHP sessions.

    Yet, when I do my little ole testing on Kubrick, this is what I have repeatedly learned.

    * In its original form, it validates beautifully.

    * If a plugin is added, and that plugin uses PHPsessions, then it will “bork” on the validation.

    * If the plugins are removed, I am still getting a validation error and it isolates it to the wp_list_cats() tag.

    * In my test, I have two wp_list_cats() tags because I originally thought it might be how I was listing the parameters in the tag that might be causing the problem. So I deleted my version of the wp_list_cats() tag, leaving the default tag, and the validation passes.

    * So I replaced the default wp_list_cats() tag with my version, so it is the only one in the sidebar, and the validation error with PHP sessions is back.

    This is my tag:

    <li><a title="Thoughts on Life" href="index.php?cat=7">Journal Thoughts</a></li>
    <?php wp_list_pages('exclude=497&depth=1&sort_column=menu_order&title_li='); ?>

    * So I get rid of the link to my blog and leave wp_list_pages() since the errors are targeting the request for index.php?cat=7 and BINGO, with the wp_list_pages tag, it validates.

    * Leaving the wp_list_pages() tag in, I added back in the two plugins from the first borked validation WITHOUT the single link to the blog and …it passes the validation!!!!!

    My link reference uses index.php?cat=7 and this is the criminal that is “calling” sessions. To get the link, I clicked on the category for my blog and copied the link address directly from the address bar. This link will change when I finally get to activating permalinks on this test site, but why wouldn’t this work as it is?

    Mystery semi-solved. HELP!

    I’ve been trying techniques to get around the PHP session errors triggered by a link to the category, and the only way it is defeated is to HARD LINK with an absolute link to the category. So the link would be:


    Anyone found a work around yet for linking to a category without permalinks that is relative rather than absolute? I don’t know why this triggers PHP sessions, but it’s painful.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Odd Validation Error in list_cats tag’ is closed to new replies.