Spring Sale! Save 30% on all books w/ code: PLANET24
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.

About the Author
Jeff Starr = Designer. Developer. Producer. Writer. Editor. Etc.
Wizard’s SQL for WordPress: Over 300+ recipes! Check the Demo »

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 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 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 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 »
SAC Pro: Unlimited chats.
Thoughts
I live right next door to the absolute loudest car in town. And the owner loves to drive it.
8G Firewall now out of beta testing, ready for use on production sites.
It's all about that ad revenue baby.
Note to self: encrypting 500 GB of data on my iMac takes around 8 hours.
Getting back into things after a bit of a break. Currently 7° F outside. Chillz.
2024 is going to make 2020 look like a vacation. Prepare accordingly.
First snow of the year :)
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.