Support » Requests and Feedback » get_links() Uses single quotes in HTML. Yuck!

get_links() Uses single quotes in HTML. Yuck!

  • As the title says, whoever wrote get_links() should be reprimanded:

    if ('' != $title) {
    $title = " title='$title'";

    This definitely needs to be updated in the next build of WP–there’s no reason to use single quotes like this and it’s not exactly semantically correct.

    Obvious fix:

    if ('' != $title) {
    $title = ' title="' . $title . '"';

    By the way–it’s worth pointing out that using double quotes is SLOWER than using single quotes (I don’t want to get in to exactly why, but put simply: PHP has to look for variables to parse in double quote strings but it doesn’t in single quotes). In the WP source there are thousands of instances of pointless use of double quotes seemingly for no reason except laziness. While I understand this is due to the fact that WP is a work in progress and has come a long way, it’s probably time to start paying more attention to things like this.

    When you have 22 queries on a page and countless plugins, speed begins to matter. Instances like the one above can be fixed will help WP become a better product in the end.

    That said, WP is excellent and you’re all doing great work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Please note the tone of the above message was supposed to come off somewhat sarcastically, but I just reread it and I sound like a jerk. My fault!

    I’m finding attributes surrounded by single quotes all over the place in Strayhorn. Attributes should be within double quotes for proper validation. I’m running my page through HTMLTidy on-the-fly [http://www.rallycentral.us/archives/2005/02/08/html-tidy-on-the-fly/] and it gives me grief when I get an <a href="http://www.google.com"> It turns it into <a href="http://www.rallycentral.us/"http://www.google.com//"> I’m hacking up my code all over the place.

    I’m not going to quit using WordPress. This is my 3rd blogging software I’ve used, and it’s the easiest & best, but the singlequote/doublequote issue should probably be addressed before WordPress 2.0 comes along. In fact, I’m giving consideration to joining the development team just to change them, one at a time before 2.0 arrives. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_links() Uses single quotes in HTML. Yuck!’ is closed to new replies.
Skip to toolbar