# Allow Custom JS in Block

**URL:** <https://forum.pinegrow.com/t/allow-custom-js-in-block/8452>\
**Category:** Feature Request\
**Tags:** feature-request, wordpress\
**Created:** [October 20, 2023, 8:25pm UTC](https://forum.pinegrow.com/t/allow-custom-js-in-block/8452 "2023-10-20T20:25:58Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)\
**Post date:** [October 24, 2023, 8:22am UTC](https://forum.pinegrow.com/t/allow-custom-js-in-block/8452/4 "2023-10-24T08:22:56Z")

</div>

@jonroc the best way is to use WP hooks to ensure that the code runs at the correct time. For example, blocks are registered in the `init` hook with the default priority 10.

If you wish to run some code after all the blocks are registered use this in `inc/custom.php`:

```auto
add_action( 'init',function() {
    //do something
}, 100);

```

The priority parameter `100` causes this hook to be called at the end.

(posting the same to [the linked topic](https://forum.pinegrow.com/t/move-require-once-inc-custom-php-to-bottom-of-functions-php/8250/1))

---

_[View the full topic](https://forum.pinegrow.com/t/allow-custom-js-in-block/8452)._
