Is it possible to be more page/post specific with admin_enqueue_script?

The $hook_suffix global (copy of which you are getting passed to the hook) doesn’t go into such detail.

However there is plenty more of context to check. In modern WP versions bulk of it is via get_current_screen() which returns WP_Screen object with plenty of stuff (in this case you would want to check id and post_type properties likely).

As for post’s ID — get_the_ID() should work perfectly fine in that context.

Leave a Comment