Adding Dynamic Attributes in Script Tag for 3rd party JS

Đã có trọn bộ đề thi thử THPT Quốc Gia 2022 các môn: vip.dethihsg247.com

I saw that someone had asked how to add attributes in script tag for 3rd party JS here: Adding Additional Attributes in Script Tag for 3rd party JS

My question is how to also make those attributes dynamic if I were to write a WordPress plugin that would take in a value that the user inputs via a widget.

The script_loader_tag filter only takes in 3 preset parameters ($handle, $tag, $src) so I can’t figure out how to add in custom params to the $tag = str_replace( 'src=', 'data-attribute="'.$dynamicvar.'" src=', $tag ); from the parent function it’s contained in.

Any help would be appreciated

Xin chào các bạn và quý Thầy Cô. Hãy nhập từ khóa mình muốn vào ô tìm kiếm trên Website để tìm kiếm mọi thứ hoặc trên google các bạn hãy nhập từ khóa + dethihsg247.com để tìm kiếm các bài viết của chúng tôi nhé.
  • Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
  • Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
  • Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.

Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com