wp enqueue script – Why does script_loader_tag loop values multiple times?
Question
If I call another function script_loader_tag
, it loops through the results from the function as many times as they are script
values associated with $tag
.
For example, here’s a simple function
function test() {
$test_value = array ('a', 'b', 'c');
return $test_value;
}
If this function is called in script_loader_tag
e.g var_dump($skip);
, it outputs the below which mirrors the number of scripts.
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
0
2 years
2022-02-26T15:23:43-05:00
2022-02-26T15:23:43-05:00 0 Answers
0 views
0
Leave an answer