Tuesday, July 17, 2018

Find and replace text or link in all the wordpress posts and pages

Searching and replacing contents in all the wordpress posts and pages is an easy task. You can use either plugin or manually using SQL query. In this article, we will let you know the SQL query to find and replace particular text or word from wp_posts, wp_postmeta tables
Find and replace in wordpress Posts and Pages
Find and replace in wordpress Posts and Pages

Before starting the find and replace in wordpress posts and pages task, take backup of entire website database. If you are good in SQL, then take backup of wp_posts and wp_postmeta tables alone

You can use following queries to update all the http requests to https after installing SSL certificate

Syntax

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'Text to Find', 'Text to Replace');

Query

UPDATE wp_posts SET post_content = replace(post_content, 'Text to Find', 'Text to Replace');
UPDATE wp_posts SET guid = replace(guid, 'Text to Find', 'Text to Replace');
UPDATE wp_postmeta SET meta_value = replace(meta_value,  'Text to Find', 'Text to Replace');

No comments:

Post a Comment