---
url: /cookbook/rename-elements.md
description: >-
  Rename element definitions across stored WPCE documents by replacing quoted
  IDs inside base64-encoded database data.
---

# Rename Elements in the Database

You can use the following SQL snippet to rename all elements of a certain type in the database:

```sql
UPDATE cptwp_postmeta
    SET meta_value = TO_BASE64(REPLACE(FROM_BASE64(meta_value),
        '"old-element-id"',
        '"new-element-id"'
    ))
    WHERE meta_key = '_wpce_doc';
```
