Janik von Rotz

1 min read

Update Url within WordPress Post Content

Recently I’ve change the url for one of my GitHub projects.

As you might know, I’ve used this url in several posts. In order to make this obsolete links I have to replace them in every posts.

This easy done with the following SQL query:

UPDATE wp_posts SET post_content = REPLACE (post_content, 'https://www.oldsiteurl.com', 'https://www.newsiteurl.com')

To run this SQL script you have to able to access the WordPress MySQL database.

To get you further into the possibilities of manipulating the WordPress database content with queries, I’ve collected the most useful queries in a gist: https://gist.github.com/8914414

Categories: Web development
Tags: sql server , wordpress
Improve this page
Show statistic for this page