How to insert text infront of and after a value in a column, for every value in that column?

I have a table with meta values for posts in wordpress, the table is called wp_postmeta

This table has two important columns called meta_key and meta_value

Read More

One of the Meta Key’s are website and the corresponding values are a url
(Example www.accentweb.ca)

What I would like to do is take that value and create a link to it with it’s own value as the link:

That is www.accentweb.ca into

<a href="http://www.accentweb.ca" target="_blank">www.accentweb.ca</a>

What would I use for an sql command, I have been working on this using set value and a few others but cannot seem to get it to work, idea’s?

Related posts

Leave a Reply

1 comment

  1. Is this what you’re after?

    UPDATE wp_postmeta
    SET metavalue = '<a href="http://' + meta_value + '" target="_blank">'+meta_value+'</a>'
    WHERE meta_key='website'