How to Insert a Link Into a Photo Caption in WordPress
Using the standard link creation button in WordPress, it is impossible to insert a link into a photo caption. This is because the code that WordPress uses to generate a photo caption places double quotation marks at the beginning and end of the caption. Because the HTML code used to create a hyperlink also uses double quotation marks, the code is lost. Add the code for the hyperlink manually using the HTML post editor and replace the double quotation marks with single quotation marks. When you publish the post, the hyperlink is displayed correctly.
Instructions
-
-
1
Open the "Posts" menu on the WordPress dashboard and select "All Posts" to edit an existing post or "Add New" to create a new post. Complete the post as you normally would, adding a title, body text and images with captions. Continue when you are satisfied with the post and ready to publish it.
-
2
Click the "HTML" tab at the top of the window to display the HTML source code for the post.
-
-
3
Locate the image caption to which you want to add a link. In WordPress, the source code for an image caption looks similar to the following:
[caption id="attachment_62" align="alignleft" width="300" caption="Image caption"] -
4
Click to place the cursor in the space immediately before the word or words that readers will click to navigate to the link and type the following code:
<a href='http://www.website.com'> Replace "www.website.com" with the URL of the website or page to which you want to link. -
5
Click to place the cursor in the space immediately after the word or words that readers will click to navigate to the link. Type the code "</a>." The caption code now looks similar to the following:
[caption id="attachment_62" align="alignleft" width="300" caption="<a href='http://www.website.com'>Image caption</a>"] -
6
Click the "Publish" or "Update" button at the top of the window to save the post.
-
1
Tips & Warnings
Do not click the "Visual" tab at the top of the post editing screen to return to the visual post editor after inserting a link in a photo caption. When you return to the visual post editor, WordPress strips the link from the caption, requiring you to enter it again.