Closed lkraav closed 8 years ago
Understood. I'll do some testing and try to reproduce.
I decided to go with this: https://github.com/ronalfy/metronet-tag-manager/blob/master/metronet-tag-manager.php#L326
If you have time, please give it a go and I'll try to push out a release this evening.
This lgtm and works correctly, thanks.
For the release, perhaps you also want to pick up this https://github.com/lkraav/metronet-tag-manager/commit/59d97ea1ba429ba45ce27ca2a02ae5794e700cc8
Had to change to sprintf
to allow for the new line, but this seems to be working: https://github.com/ronalfy/metronet-tag-manager/blob/master/metronet-tag-manager.php#L341
Going to close out the issue. I'll push out a release tonight.
1.0.6
Arrays and objects don't currently work.
preg_replace_callback()
isn't going cut it in this scenario, where non-string data needs to go out, because$value
coming in fromapply_filters( "gtm_" )
will be set toArray
.Just return an array from any of your variable filters to reproduce this.
Take a look at https://github.com/lkraav/metronet-tag-manager/commit/09d6202a854a9380a4775674b6f96ac809701864
It's minimally invasive and does the job, but I don't know all the use cases that
preg_replace_callback()
is supposed to handle - whether a simplestr_replace()
is enough or not.Bad output (check
user_role
key at the end):Correct example output: