# TypeError: Discourse.\_registerPluginCode is not a function

**URL:** https://meta.discourse.org/t/typeerror-discourse-registerplugincode-is-not-a-function/88572
**Category:** Support
**Created:** [May 28, 2018, 8:06am UTC](https://meta.discourse.org/t/typeerror-discourse-registerplugincode-is-not-a-function/88572 "2018-05-28T08:06:21Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![amotl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/amotl/32/109873_2.png) [@amotl](https://meta.discourse.org/u/amotl)
#### Post date: [January 15, 2019, 2:57am UTC](https://meta.discourse.org/t/typeerror-discourse-registerplugincode-is-not-a-function/88572/5 "2019-01-15T02:57:03Z")

</div>

Thanks @vinothkannans for getting back and for pointing us to @sam’s comment. After following this to [JavaScript not loading on certain pages](https://meta.discourse.org/t/javascript-not-loading-on-certain-pages/92297) and drilling down a bit further we would like to share our findings.

> [@amotl](#):
>
> When looking at the `Discourse` object, it tells us it’s pretty much empty:
> 
> ```javascript
> » Discourse
> » > Object { SiteSettings: {} }
> 
> ```

While the origin of this pretty much void object pretending to be a real Discourse instance

```plaintext
const Discourse = {
  SiteSettings: {}
}

```

is yet unknown, it will easily sneak through some safeguards the Discourse plugin loader had put into place, so

> [@amotl](#):
>
> ```plaintext
> if ('Discourse' in window) { 
> Discourse._registerPluginCode('0.8', function (api) {
> // [...]
> }
> }
> 
> ```

would obviously be completely clueless about this and will just attempt to run the plugin registration right away as if nothing happened, ultimately croaking there.

---

_[View the full topic](https://meta.discourse.org/t/typeerror-discourse-registerplugincode-is-not-a-function/88572)._
