Wrong hook filter usage
-
You’re using the wrong hook in this plugin. esc_url is designed for sanitizing urls and not for manipulating the HTML tags.
You should use the hook for script_loader_tag instead. Attached is the sample code from wpmu site that shows how to add attributes to the script tag.
add_filter( 'script_loader_tag', function ( $tag, $handle ) { return preg_replace("/(><\/[a-zA-Z][^0-9](.*)>)$/", " async $1 ", $tag ); }, 10, 2 );
Please implement it soon and push a new version if you’re actively developing. Or I’d love to contribute to the plugin as a developer.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Wrong hook filter usage’ is closed to new replies.