How to fix the ‘href URL must be absolute’ Facebook Like Button error

Many Facebook like buttons stopped working today due to some changes internally on how the Like button functions with respect to content restrictions, publishing updates and interactions with users. Many sites using the HTML5 or XFBML methods to share content saw a link labeled as “Error” on their pages. When they clicked on the error, they get a small window that states:

The href URL must be absolute

Facebook - The href URL must be absoluteThis confused me at first. I thought I was passing an absolute URL. It turns out I was, but I did notice a difference. In my sharing button, I was using the urlencode function.

echo urlencode(get_permalink());

The fix for this is simple, thankfully. Update your code to no longer use the urlencode function.

echo get_permalink();

If you’re not using PHP or WordPress, but rather have your share code embedded directly in the HTML, make sure you use the full path of the URL (

This should take care of the error message you’re seeing.

* Update: Some users that are using the Digg Digg plugin for WordPress are experiencing this issue. I am using Digg Digg without error. If you use a social sharing plugin, please check to see if it is working or if there’s an update waiting for you. I would not recommend changing the source code of the plugin.

Are you still having trouble with this update? Share in the comments below, and I’ll be happy to help.

  • Pierre

    Brandon, I use DiggDigg and I have the error. Thought I would let you know. Iam going to attempt manual intervention. Wish me luck.

  • Chris Murvine

    Same here, Brandon — The Facebook Like button in Digg Digg is choking on our site as well.

  • Pierre

    On digg-digg.php I found this: $postlink = get_permalink($id); //get post link]. I suspect though that this next line is the culprit: $link = explode(DD_DASH,$postlink); //split the link with ‘#’, for comment link. If you comment it out, diggdigg works, but not sure what else breaks. 😉

  • Brandon Coppernoll

    When commenting out that line, is the Facebook Like button still functioning?

  • Brandon Coppernoll

    Interestingly enough, I’m using Digg Digg with no error.

  • Pierre

    Yip, works as expected. No further facebook error. Again, not sure on other consequences of this – suspect that now if the url contains #comment or #respond, as an example, facebook might see that as part of the unique url for the new “like”. Still testing this.

  • Brandon Coppernoll

    It might. I’m not sure how picky Facebook really is. Good find though.

  • Pierre

    The floating bar? Thats where I get the error, not above/below post.

  • Pinto

    I commented line 1105 on dd-class.php

    $url = rawurlencode($url);
    //$url = rawurlencode($url);

    it stops encoding the url just for the fblike_xfbml button

  • Brandon Coppernoll

    Thanks! That looks like a good fix.

  • Pierre

    Thanks Pinto! Much better!

  • Pierre

    Could be unrelated, but my most popular post lost all its likes. I’ve logged a bug with facebook developers. Strange.

  • Calvin Williams

    Thanks, that was a big help. I’m using the Slick Social Share Buttons plugin for WordPress, I had to go in manually and fix the code in that plugin. Oddly enough, the Facebook button worked in everything except Google Chrome. Weird.

  • Rhondi

    Where do I go in my dashboard to change the code?

  • Brandon Coppernoll


    If you can get to the files, that is the best place to make a change because you can make a backup if something goes wrong. If there’s a code error you could inadvertently lock yourself out of the dashboard until it’s corrected.

    However, if you need to use the dashboard, it depends on whether or not it’s in your theme or plugin. For a theme, go to Appearance > Editor. For a plugin, go to Plugins > Editor.

    Again, I can’t stress enough the best way to make the update is on the file itself after you made a backup. You don’t want to lock yourself out of the dashboard or crash your site.

  • Catalin

    Hey Calvin, i have same problem with Slick Social Share Buttons, where u edit and what u edit! I was looking @ dcwp_slick_social_buttons.php but…nothing found there!Ty

  • Calvin Williams

    Look for dcwp_social.php in the “inc” folder. For me it was line 110 I had to change. The line is $elink = urlencode($link); Remove the urlencode function so you have $elink = $link; and you should be good. Hope that helps!

  • Rhondi

    Went to the file but can’t find that code. I’m using Facebook Social Plug ins by Olivier Lussier Thanks

  • Jamie

    Me too. the same plugin and I also have the same browser issue,

    I also found that if i was logged in to FB it showed the error and when I log out the button goes back to normal.?

    Did anyone loose there like count, I hear this can affect your numbers?

  • Catalin

    Now is working, ty Calvin!

  • goLIVEmiami

    It looks fine in Safari but not on Chrome. Already replaced the digg digg file with one I found that had edited code.

  • nana

    Thank you!

  • Bleki


  • Jason Frega

    What if I need a dynamic ULR in the href? For example my FB Like button is in the general code for the page, it shows up on every post, and depending on what post it needs a different URL.

  • Brandon Coppernoll

    I’m assuming you mean for a WordPress post. If that’s the case, you can likely include the permalink. Would something like this work for you?