Support » How-To and Troubleshooting » Post title XHTML validation error

Post title XHTML validation error

  • So, I upgraded to WordPress 2.0, everything looks good so far, but some XHTML validation error that does not happen before happen now, which is kinda annoying.

    First of all, post title is not properly parsed. I have a post which title is “Bold&Delicious”, and it gives me validation error when I try to validate my post. Obviously, WP2 do not change & into “& amps;”. Also, another post title called “YUI’s “LIFE”” gives me validation error when it is rendered by the theme as ” title=”YUI’s “LIFE”” “, see how it works?

    These problems are not found in WP1.5, so is this a bug for WP2.0? I’m thinking of adding htmlentities or htmlspecialchars to $title in “template-function-post.php” in order to fix this problem, any suggestion?

    Thanks for the feedback, much appreciated!

Viewing 1 replies (of 1 total)
  • I realized the problem lies on “comments_popup_link” functions. When getting post title to be used, the functions takes the title directly from the database without parsing it with htmlspecialchars. Here’s a way to fix it:

    – open “comment-functions.php” in wp-includes folder
    – find function “comment_popup_link”
    – change “sprintf( __(‘Comment on %s’), $post->post_title ) ” to “sprintf( __(‘Comment on %s’), htmlspecialchars($post->post_title) )”

    btw, isn’t this considered as a WordPress 2.0 bug?

Viewing 1 replies (of 1 total)
  • The topic ‘Post title XHTML validation error’ is closed to new replies.