Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

I need help making facebook (og) read the correct canonical url WordPress


At the bottom of all pages on is an addthis box that allows sharing via facebook.

When you share home, or a page, with FB og does the right thing and extracts the title, thumbnail, description, etc:

However, when you try to share any single post such as then FB reads the canonical url as /posts, which throws a 404.

You can cut to the chase and try using this validator to test things out:

The only differences between the og meta data on pages vs posts is that pages are og:type=website and posts are og:type=article... I was hoping that might make the url problem go away.. You can see the difference in the header of each...

So what would solve this?
I'll consider this solved when you can share the above /posts/18569 and FB extracts the proper title, excerpt, and thumb. Thanks!

Access to a staging server is available.

PS - This site uses a very odd permalink structure with some whacky rewrites in place. I inherited it and hope to remake it asap.


Answers (8)


webGP answers:


Open AddThis settings page, switch tab to Advanced, uncheck the "Track clickbacks" option and save changes, it should help.

Jason Lemieux comments:

Thanks for the idea. I did give it a try but not dice :(

Jason Lemieux comments:

Hey Grzegorz,

It turns out the problem was that addthis was still throwing a tracking code in the url because of a parameter in the script tag data_track_addressbar":true.

The tracking code wasn't showing up for me because of the CDN somehow stripping it out. I have no idea how/why.

I'm going to split the bounty between you and Martin. You for your idea, he for his time.

Thanks everyone!


Martin Pham answers:

I checked this issue in the demo [[LINK href=""]][[/LINK]]

I think this issue belongs Permalink structure and htaccess. I can handle this problem for you, Permalink will not change. I need access to some files of your theme, contact me if you agree with this (email: [email protected] )

Jason Lemieux comments:

Hey Martin,

Ok, sounds like a plan. Let's start here. I'll PM you access.

Jason Lemieux comments:

Hey Martin,

Your solution was very close but there are a few things to tie up. Are you still around?


Michael Caputo answers:

I've not seen a <head> tag that looks like that...

Maybe try just making it say <head>, and if possible place the meta tags right after the <title> tag.

Jason Lemieux comments:

Mmmm i've already tried that :(

Michael Caputo comments:

I've copied the code from this page to an html file on my own server, and the debugger gives it an OK. - My guess is it has something to do with your Htaccess file, or permalinks.

Jason Lemieux comments:

Thanks, Michael.

I'm trying to make sense of your results. Did you take test.html down already? The debugger says the page threw a 404, yet it manages to still display some of the og data. Maybe from a cached version of some kind? I'm quite confused.

If it does turn out to be an htaccess problem do you have the chops to figure it out? I'm not in a position to really modify the permalink structure at this point in the life of the site.

The part that drives me nuts is this: ok, /posts is a 404, yet /posts/xxxx is an actual article. I agree that is a pretty messed up way to make a site but it wasn't me and it's what we have to work with. That said.... why isn't og happy to just work with the urls we send it instead of trying to get all canonical on things? There's got to be some way to make it happen.