• I started building a WordPress theme from scratch and got to the point where I should call wp_head() in my header.php file. Then my server started spewing single-quoted links to all kinds of stuff that no one even uses. I may have tolerated the links’ presence if they had been double quoted but single quotes? Is this 1997? Get a grip on reality, kids. What kind of garbage are you pushing?

Viewing 9 replies - 1 through 9 (of 9 total)
  • What are you talking about?

    Thread Starter Fedge

    (@fedge)

    Let’s just eschew quotes altogether for a while because no one will ever have to parse our output or generate any kind of valid code.

    Thread Starter Fedge

    (@fedge)

    I’m talking about this.

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8" />
    <title><a href="https://codex.www.ads-software.com/redacted">redacted</a></title>
    <link rel="profile" href="https://gmpg.org/xfn/11" />
    <link rel="stylesheet" type="text/css" media="all" href="https://192.168.0.16/wp-content/themes/<a href="https://codex.www.ads-software.com/redacted">redacted</a>/style.css" />
    <script src="https://192.168.0.16/wp-content/themes/<a href="https://codex.www.ads-software.com/redacted">redacted</a>/mootools-core.js" type="text/javascript"></script>
    <script src="https://192.168.0.16/wp-content/themes/<a href="https://codex.www.ads-software.com/redacted">redacted</a>'/mootools-more.js" type="text/javascript"></script>
    <link rel="alternate" type="application/rss+xml" title="<a href="https://codex.www.ads-software.com/redacted">redacted</a> ? Home Comments Feed" href="https://192.168.0.16/sample-page/feed/" />
    <link rel='stylesheet' id='admin-bar-css'  href='https://192.168.0.16/wp-includes/css/admin-bar.min.css?ver=3.5.2' type='text/css' media='all' />
    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://192.168.0.16/xmlrpc.php?rsd" />
    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://192.168.0.16/wp-includes/wlwmanifest.xml" />
    <link rel='next' title='News' href='https://192.168.0.16/news/' />
    <meta name="generator" content="WordPress 3.5.2" />
    <link rel='canonical' href='https://192.168.0.16/' />
    <style type="text/css" media="print">#wpadminbar { display:none; }</style>
    <style type="text/css" media="screen">
    	html { margin-top: 28px !important; }
    	* html body { margin-top: 28px !important; }
    </style>
    </head>
    <body>
    <div id="main">
    </div>
    </body>
    </html>
    Thread Starter Fedge

    (@fedge)

    After the two script tags up to the end of the head tag was all generated by WordPress. What is this?

    Thread Starter Fedge

    (@fedge)

    Also, apparently putting two square brackets and writing redacted inside them generates some links in your site too so I am displaying double errors now just trying to show this to you :(((((

    Thread Starter Fedge

    (@fedge)

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8" />
    <title>*redacted*</title>
    <link rel="profile" href="https://gmpg.org/xfn/11" />
    <link rel="stylesheet" type="text/css" media="all" href="https://192.168.0.16/wp-content/themes/*redacted*/style.css" />
    <script src="https://192.168.0.16/wp-content/themes/*redacted*/mootools-core.js" type="text/javascript"></script>
    <script src="https://192.168.0.16/wp-content/themes/*redacted*'/mootools-more.js" type="text/javascript"></script>
    <link rel="alternate" type="application/rss+xml" title="*redacted* &raquo; Home Comments Feed" href="https://192.168.0.16/sample-page/feed/" />
    <link rel='stylesheet' id='admin-bar-css'  href='https://192.168.0.16/wp-includes/css/admin-bar.min.css?ver=3.5.2' type='text/css' media='all' />
    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://192.168.0.16/xmlrpc.php?rsd" />
    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://192.168.0.16/wp-includes/wlwmanifest.xml" />
    <link rel='next' title='News' href='https://192.168.0.16/news/' />
    <meta name="generator" content="WordPress 3.5.2" />
    <link rel='canonical' href='https://192.168.0.16/' />
    <style type="text/css" media="print">#wpadminbar { display:none; }</style>
    <style type="text/css" media="screen">
    	html { margin-top: 28px !important; }
    	* html body { margin-top: 28px !important; }
    </style>
    </head>
    <body>
    <div id="main">
    </div>
    </body>
    </html>

    I’m still struggling to see where the issue is. There is nothing in the W3C specs that makes double quotes mandatory.

    I am curious too, why the single quotes are an issue. I am sure the poster has a legitimate point, a practical reason why single quotes are a problem, in spite of the W3C standards supporting them.

    Could you please show us your PHP instead of the generated HTML. WordPress does not use single quotes in links when generating HTML. The WordPress PHP coding standard is to use single quotes around strings so that double quotes can be used for urls etc..

    The only reason this would happen is from escaping via the esc_url() function that core uses when outputting those links. If there is a syntax error or missing quote in your PHP or something else that would cause the url to break out of the quotes then alternate quotes would be used. This is a security benefit. Please show your PHP and I can tell you exactly why the HTML is being generated the way it is.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘What the hell are you doing?’ is closed to new replies.