• Business
  • Free
  • Interesting
  • Web Design
  • Web Development
  • Inserting hyperlinks in Wordpress image captions

    By Danno

    Users of Wordpress 2.6 will know that you can insert captions underneath photos and images within your posts. If any of you have tried to add hyperlinks within a caption, you’ll also know that Wordpress will strip that link faster than a suspected terrorist at LAX when you hit save.

    "Baby, I know how to add hyperlinks to Wordpress captions". "Yeah, that's so hot".Photo by superbomba.

    "Baby, I know how to add hyperlinks to Wordpress captions."

    Now, I’m not techy enough to know exactly why Wordpress strips links from captions but it does. I do know that with some fiddling about, I finally found a fairly straight forward workaround that doesn’t involve custom fields or plugins.

    My situation might be a little different. I wanted to actually have a secondary caption of sorts to use as a photo credit and have a caption for the photo.

    What seems to work for hyperlinking text within Wordpress captions is nesting the link within small tags before the end of the Wordpress caption tag, like this:

    PGNvZGU+DQo8c21hbGw+RXhhbXBsZSBvZiA8YSBocmVmPSJodHRwOi8vd3d3Lmxpbmt5bGlua3kuY29tLyI+DQpsaW5rZWQgY2FwdGlvbiB0ZXh0PC9hPi48L3NtYWxsPg0KWy9jYXB0aW9uXQ0KPC9jb2RlPg==

    I’m not sure why this technique of using small tags does the trick. As you can see from the picture above, it does work.

    Once you’ve got your small tag in there, you’ll need some CSS if you want to position that tag somewhere special. I wanted it off to the left so that it would be a photo credit, visually separate from the caption but still within the Wordpress caption tags. The CSS I used for positioning is as follows:

    PGNvZGU+DQojY29udGVudCBzbWFsbCB7DQoJZm9udC1zaXplOiAwLjdlbTsNCgljb2xvcjogIzc1NzU3NTsNCglmbG9hdDogbGVmdDsNCn0NCjwvY29kZT4=

    Hope this works for you and if you have another, preferably easier or sound workaround for this issue, lets hear it.

    • Digg
    • del.icio.us
    • StumbleUpon
    • description

    More...

    About the author

    Danno started remote freelancing in 1996 and worked as little as possible in order to snowboard as much as possible. He is the co-founder and (ex) President of Graphics.net, owner of FeedIcons.com, EliteFreelancing.com, FastCharacters.com and SteelAndSnow.com. His favorite shape is a circle.