Title: Replace something in Post_meta SQL Table
Last modified: August 31, 2016

---

# Replace something in Post_meta SQL Table

 *  [hegi](https://wordpress.org/support/users/hegi/)
 * (@hegi)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/replace-something-in-post_meta-sql-table/)
 * Hey
 * i want to replace a word in the main Content of an Site. But because of the Sitebuilder
   Plugin the Content is Stored in many Arrays in the Post_meta “panels_data”. So
   i tried to replace the Words in the SQL rather than in the Arrays.
 * I tried the following but nothing happened an i dont get an error message:
    The
   Variable $new_post_id is the ID from the Post i want to change.
 * $query = “UPDATE wp_postmeta WHERE post_id = “.$new_post_id.” SET panels_data
   = REPLACE (panels_data,’NAME1′,’NAME2′)”;
    $wpdb->query($query);

Viewing 1 replies (of 1 total)

 *  [Takis Bouyouris](https://wordpress.org/support/users/nevma/)
 * (@nevma)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/replace-something-in-post_meta-sql-table/#post-6981645)
 * Are you certain that this plugin saves its data in the post meta table? I would
   suggest you make sure of that first. Search also inside the posts and options
   table so that, first of all, you will know for sure where these data are.
 * However, in any case, even when you find what you are looking for, if the data
   are stored in PHP arrays, then replaceing them like you say will probably break
   them. This is because PHP objects have a special formality, which is handled 
   by PHP, and keep track of string lengths, etc. So if you manually change ie a
   string inside them they might break.
 * The correct way to do this is to write a bit of PHP code that iterates over the
   database rows you need, or, even better, over the objects (be it posts, options
   or post meta) that you need to change and then edit and re-save them via PHP.

Viewing 1 replies (of 1 total)

The topic ‘Replace something in Post_meta SQL Table’ is closed to new replies.

## Tags

 * [20q2016](https://wordpress.org/support/topic-tag/20q2016/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Takis Bouyouris](https://wordpress.org/support/users/nevma/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/replace-something-in-post_meta-sql-table/#post-6981645)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
