First I enqueue a script using:
wp_enqueue_script( "script", plugins_url( "/test/js/script.js", PATH ), array("jquery"), VERSION, true );
Then I'm inserting an inline script after "script".
wp_add_inline_script( "script", "console.log('hello world');" );
Now I need to add defer or async attribute to my inline script, is there a way to do this to a script embedded by wp_add_inline_script() ?
wp_enqueue_script( "script", plugins_url( "/test/js/script.js", PATH ), array("jquery"), VERSION, true );
wp_script_add_data( 'script', 'async/defer' , true );