New Bookstore! Save 20% on books with discount code: LAUNCH
Web Dev + WordPress + Security

WordPress Error Fix: Unable to Parse URL

For those of you running an older version of WordPress that is generating errors that look like any of these fabricated examples:

Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067 
Warning: parse_url(http://) [function.parse-url]: Unable to parse url in /home/path/to/public_html/wordpress/wp-includes/functions.php on line 1067

You can easily resolve the issue by suppressing these errors, which are automatically generated whenever the parse_url() function tries to parse an empty value for the URL. To silence the errors, open the file wp-includes/functions.php and locate the following code (around line #1067):

$parsed = parse_url('http://' . $value['url']);

In that line, place an “@” symbol before the “parse_url” like so:

$parsed = @parse_url('http://' . $value['url']);

And that should do it. The “@” symbol works to suppress any errors generated by the parse_url() function. So say goodbye to those relentless PHP errors. Additionally, you might want to make a note of the change somewhere just in case you decide you upgrade or reinstall WordPress. Cheers!

Note: This information is intended primarily for WordPress versions previous to 2.3, but may be applicable in other versions as well. Not recommended to modify the WP core in newer/current versions of WordPress.

Jeff Starr
About the Author
Jeff Starr = Designer. Developer. Producer. Writer. Editor. Etc.
GA Pro: Add Google Analytics to WordPress like a pro.

8 responses to “WordPress Error Fix: Unable to Parse URL”

  1. Bart Gysens 2009/06/15 5:03 am

    Now located in: /wp-includes/script-loader.php > rule #534

  2. Jeff Starr
    Jeff Starr 2009/06/15 6:54 pm

    Awesome, Bart — thank you for the updated information. :)

  3. Bobby Kozora 2009/10/13 6:01 am

    Is there a more solid solution? What’s actually causing that error? I’m wary of simply suppressing the errors, I’m more interested in solving the cause for such errors. Any suggestions?

    One interesting thing is the port its using is not correct. For my local testing purposes I’m running on port 10088, not 100881. Maybe this has something to do with it?

  4. Jeff Starr
    Jeff Starr 2009/10/13 8:14 am

    I wish I knew.. I guess I stopped worrying about this once the errors stopped appearing in my log files, but it would be good to actually resolve the error. I recall spending a great deal of time trying to locate the source of the issue, but eventually settled for suppression after not being able to pin it down.

    I do know that this only seems to effect older WordPress, and hasn’t been an issue for me with more recent versions. So that would be one recommendation, assuming you haven’t already upgraded.

    As for the port, I eliminated that as a possible variable back when I was researching this issue, not to say that it isn’t a possible factor in your situation.

  5. Bobby Kozora 2009/10/13 8:58 am

    That’s what’s strange to me. I’ve got the latest version of WordPress, 2.8.4. I’m trying it into a site using xcart but the wordpress files have no ties to the xcart site, they just coexist in the same directory and database table.

    It’s not of pressing concern right now but if I get some time I’ll do some research and let you guys know what I discover.

  6. This is still an issue in 2.9.2, which I downloaded only yesterday. Looks like it is a rare bug though – it only happens if the URL operates on a range of high port numbers. If a “1” can be concatenated to the end of your port number to make it invalid, an error will result. I believe port numbers cannot be larger than 65535.

    The solution can be found in the supplied link.

  7. And the link (which crashed commenting in the last post) is thus:

    http://www.hashbangcode.com/blog/parse_url-warning-bug-in-wordpress-2-9-2-2566.html

  8. Jeff Starr
    Jeff Starr 2010/03/29 4:09 pm

    Thanks for the information Jon :)

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Banhammer: Protect your WordPress site against threats.
Thoughts
Take a screenshot with Firefox (no extension required). Open Developer Tools Settings and enable the “Take a screenshot” button. Then click the button :)
Take a screenshot with Chrome (no extension required). Open DevTools, type Cmd + Shift + P, then type screenshot.
After 10 years working on my 2010 iMac, my upgrade finally arrived. Shiny new iMac shipped from Ireland :)
Too much caffeine weirds me out. But I love the taste of coffee. So once in a while I enjoy a small cup of decaf. Hits the spot.
Chris Coyier is a truly awesome person. One of the finest people I've ever worked with. Just #gottasayit
Excel won't open CSV file because SYLK format? Open it with text editor and add an apostrophe ' at the beginning of the file, save changes, done.
Displaying too many social media buttons and links all over the place imho makes you look desperate and frankly kinda sad.
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.