# הדרך הטובה ביותר להוסיף קודי אימוג'י מותאמים אישית?

**URL:** https://meta.discourse.org/t/best-way-to-add-custom-emoji-codes/250966
**Category:** Migration
**Tags:** emoji, drupal
**Created:** [6 בינואר,‏ 2023,‏ 6:59pm UTC](https://meta.discourse.org/t/best-way-to-add-custom-emoji-codes/250966 "2023-01-06T18:59:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [6 בינואר,‏ 2023,‏ 6:59pm UTC](https://meta.discourse.org/t/best-way-to-add-custom-emoji-codes/250966/1 "2023-01-06T18:59:17Z")

</div>

Hi there, I’m trying to figure out the best way to clean up a bunch of emoji codes from my Drupal forum import (many of which were created when they were still known as “smiley” sets and “emoji” wasn’t even in our vocabulary yet).

I could do it in the import script (haven’t done a final production migration yet), but that would require adding about 20 additional `gsub()` calls to the already complex and slowish `preprocess_posts()` function of the importer.

I was planning on a simple find/replace with `rake posts:remap` after the final import, but each of the 20 replacements will take about an hour to run and also the remap function appears to be [quite broken](https://meta.discourse.org/t/replace-a-string-in-all-posts/48729/157).

I looked into the **Admin \> Customize \> Emoji** interface, but it won’t let me use emoji codes like `:THUMBS-UP:` with a dash, it turns dashes into underscores.

Any other better options? Thanks!

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [25 בינואר,‏ 2023,‏ 1:11pm UTC](https://meta.discourse.org/t/best-way-to-add-custom-emoji-codes/250966/2 "2023-01-25T13:11:06Z")

</div>

I just discovered the `/admin/customize/watched_words/action/replace` interface, which appears to work for this. Also allows uploading a number of replacements from a `.csv` file.

The downside is that it requires a `rake posts:rebake` to make the replacements appear in prior posts, which in my case takes over 24 hours to run. The main purpose of the **Watched Words** feature appears to be for censoring or otherwise acting on words (or emojis) that appear in _new_ posts, whereas in my case the problem is mainly with old posts where the old forum engine automatically inserted its unique codes when the user added an emoji to a post.
