# Override existing Discourse methods in plugins

**URL:** <https://meta.discourse.org/t/override-existing-discourse-methods-in-plugins/83389>\
**Category:** Developers\
**Tags:** plugin-guides, how-to\
**Created:** [March 20, 2018, 11:37am UTC](https://meta.discourse.org/t/override-existing-discourse-methods-in-plugins/83389 "2018-03-20T11:37:16Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![TimFelix](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@TimFelix](https://meta.discourse.org/u/TimFelix)\
**Post date:** [December 10, 2025, 5:36pm UTC](https://meta.discourse.org/t/override-existing-discourse-methods-in-plugins/83389/13 "2025-12-10T17:36:56Z")

</div>

i got it to work for a singleton class this way:

```plaintext
# my overrides.rb

# A module that will be prepended into TopicEmbed.singleton_class
module TopicEmbedOverrides

  # Override parse_html method
  def parse_html(html, url) # note: i dont use self. here
    # my new stuff here
    # then run original implementation
    super
  end

end

# do the override here
class ::TopicEmbed
  singleton_class.prepend TopicEmbedOverrides
end

```

---

_[View the full topic](https://meta.discourse.org/t/override-existing-discourse-methods-in-plugins/83389)._
