WordPress.org

Forums

Add image links for 700+ posts... (2 posts)

  1. jbron
    Member
    Posted 1 year ago #

    Hello,

    I just imported the 700+ entries of my photoblog in a wordpress site. Each entry has been converted into a post where the content displays a photo with an <img> tag pointing to a photo. Each post points to a different photo.

    I need to add a link for each image to the original image file.
    I have a few notions of SQL and thought I could write an update query to change each post content and add an <a> tag around the <img> tag. The href portion of the link should be the same text as the src portion of the <img> tag. How can I retreive this part of the post content in a SQL query and change it for each post? Can someone help me with the code?
    If this is too complicated, does anyone know a plugin that could add a link to an image in a post?

    Thank you.

  2. jmyeom
    Member
    Posted 1 year ago #

    this is not a WordPress related issue, you may have more luck over at stackoverflow

    the basic idea would be you need to get all posts, then use regex to get the src tag from the img and apply it to a link...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags