1 min read
Update Url within WordPress Post Content
Recently I’ve change the url for one of my GitHub projects.
- Old: https://github.com/janikvonrotz/PowerShell-Profile
- New: https://github.com/janikvonrotz/PowerShell-PowerUp
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 developmentTags: sql server , wordpress
Edit this page
Show statistic for this page