How to include variables from PHP to a JS file in WordPress One way is to use the wp_add_inline_script() function to add inline scripts to your enqueued JavaScr by Dragi Postolovski 18.03.2023