Title: Search &amp; Replace Text with HTML in database?
Last modified: August 30, 2016

---

# Search & Replace Text with HTML in database?

 *  [syncmaster913n](https://wordpress.org/support/users/syncmaster913n/)
 * (@syncmaster913n)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/search-replace-text-with-html-in-database/)
 * I have a WordPress website that contains around 200 Posts of varying lengths (
   700-1200 words each). Due to the technical nature of my site, there are various
   terms and acronyms used throughout the site (approximately 45 terms/acronyms).
   Recently I decided I would write a Glossary section for my website, wherein each
   of these 45 terms would get a short dedicated article explaining exactly what
   the term means, after which I want to link each of the respective terms/acronyms
   throughout my website to its appropriate explanation page, so that when in doubt,
   my reader can click on the term and be redirected to the page that explains the
   meaning of that term.
 * Now, obviously I don’t want to go through each of my 200 posts manually, check
   which of the ~45 terms are mentioned in it, and then link that term to its respective
   page – this would take me weeks or even months. Is there a way that I could automate
   this process by doing a database search&replace?
 * So for example, let’s say we have the term: Nitrogen-purged. This term appears
   as regular text in various places throughout the website (maybe in 100 of the
   posts, maybe in 70 or maybe in 150 of them – no clue, all I know is that it appears
   multiple times). What I’d like to do is a search&replace that would turn every
   instance of:
 * Nitrogen-Purged
 * to:
 * `<a href="http://www.example.com/glossary/nitrogen-purged/">Nitrogen-Purged</
   a>`
 * Does anyone have an idea on how to go about this?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [martcol](https://wordpress.org/support/users/hotmale/)
 * (@hotmale)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/search-replace-text-with-html-in-database/#post-6188975)
 * I have never had to do this but you can get plugins that will help e.g.
 * [https://wordpress.org/plugins/search-and-replace/](https://wordpress.org/plugins/search-and-replace/)
 * If you are up to it, you can also do it working with the database in PhpmyAdmin.
   e.g. [http://wpguru.co.uk/2014/12/how-to-find-and-replace-in-mysql-with-phpmyadmin/](http://wpguru.co.uk/2014/12/how-to-find-and-replace-in-mysql-with-phpmyadmin/)
 *  [martcol](https://wordpress.org/support/users/hotmale/)
 * (@hotmale)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/search-replace-text-with-html-in-database/#post-6188977)
 * Ooops!
 * Either way, make sure you backup everything before you do this.
 *  Thread Starter [syncmaster913n](https://wordpress.org/support/users/syncmaster913n/)
 * (@syncmaster913n)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/search-replace-text-with-html-in-database/#post-6188978)
 * Hi martcol, thanks for the answer.
 * Will the search&replace plugin replace text for regular HTML? my worry is that
   when I do that, the HTML code (<a href…) will simply appear as regular text in
   the post.
 *  [martcol](https://wordpress.org/support/users/hotmale/)
 * (@hotmale)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/search-replace-text-with-html-in-database/#post-6189020)
 * I’m not sure about that. But why not test it with a piece of unique test in a
   post and see if you can wrap that one item in an anchor tag?
 * Maybe look at other plugins that do similar things and/or ask on their support
   pages?
 * Another way to test it would be to set up a local development site on your own
   computer. Replicate your site (same theme and import data) and mess around on
   that.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Search & Replace Text with HTML in database?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [martcol](https://wordpress.org/support/users/hotmale/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/search-replace-text-with-html-in-database/#post-6189020)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
