Forums

Modify image post/attachment link and rel tags (3 posts)

  1. a fluid
    Member
    Posted 2 years ago #

    When you make a new post and upload/attach an image, WP makes the following link:

    <a href="http://www.example.com/link/to/attachment/page/" rel="attachment wp-att-###"><img ... ></a>

    But I want to modify this so that the link it makes isL

    <a href="http://www.example.com/linktoactualimage.jpg" rel="custom-rel attachment wp-att-###"><img ...></a>

    The changes being that I want the link to link to the actual picture, and I want to add a custom rel tag. How can I change this? I've looked in the media.php and upload.php files but I can't seem to find anything.

  2. SethG911
    Member
    Posted 2 years ago #

    I too would like to be able to do this. Only I want to use my image descriptions as a rel tag in the link, or as a longdesc tag in the image for lightbox purposes. I know that lines 103-115 of the wp-admin/includes/media.php change the links that are put in to the editor, but I don't want to directly edit core code. I am too unfamiliar with the add_filter tag to know how to modify core functions. Any help would be greatly appreciated.

  3. a fluid
    Member
    Posted 2 years ago #

    Are you sure about that? I just checked those lines in wp-admin/includes/media.php and I don't see anything that does what you say it does.

Topic Closed

This topic has been closed to new replies.

About this Topic