Hi,
I must admit this is the first report of this that I’ve encountered, and my test site doesn’t seem to have any issues regardless of data layer style. Which version of WP are you running? Do your error messages reveal any further detail that might be useful for debugging this?
Thanks!
Hi Tealium,
This issue seems to only happen on blog posts only. I believe its only with 2 attributes – postCategory and postTags. I am running the latest version of WP.
Notice
: Undefined index: postCategory in
/{site_path}/wp-content/plugins/tealium/tealium.php
on line
178
Notice
: Undefined index: postTags in
/{site_path}/wp-content/plugins/tealium/tealium.php
on line
178
Couple of sites that have this issue:
https://www.dropbox.com/s/mgeeibzeccjln4j/Screen%20Shot%202018-02-22%20at%2010.54.43%20AM.png?dl=0
https://www.dropbox.com/s/1iigfvfzhz715ov/Screen%20Shot%202018-02-22%20at%2010.53.17%20AM.png?dl=0
At the same time the defined values on both sites include post_tags & post_category
-
This reply was modified 8 years, 1 month ago by
shaunpez.
Hi Tealium Team,
So I did a quick test on the function of the point of error and it looks like the issue has to do with when the variable contains an array of items. Seems to be fine when the variable is a string
function tealiumConvertCamelCase( $utagdata, $arrayHolder = array() ) {
$underscoreArray = !empty( $arrayHolder ) ? $arrayHolder : array();
foreach ( $utagdata as $key => $val ) {
$newKey = preg_replace( '/[A-Z]/', '_$0', $key );
$newKey = strtolower( $newKey );
$newKey = ltrim( $newKey, '_' );
if ( !is_array( $val ) ) {
$underscoreArray[$newKey] = $val;
} else {
if ( array_key_exists( $newKey, $underscoreArray ) ) {
$underscoreArray[$newKey] = tealiumConvertCamelCase( $val, $underscoreArray[$newKey] );
}
else {
$underscoreArray[$newKey] = tealiumConvertCamelCase( $val, $underscoreArray[$key] );
}
}
}
return $underscoreArray;
}
print_r(tealiumConvertCamelCase([‘postTags’ => [‘test’, ‘test’, ‘testing’]]));
NOTICE Undefined index: postTags on line number 17
Array ( [post_tags] => Array ( [0] => test [1] => test2 [2] => test3 ) )
print_r(tealiumConvertCamelCase([‘postTags’ => ‘test’]));
Array ( [post_tags] => test )
-
This reply was modified 8 years, 1 month ago by
shaunpez.
Just checking up on this?
Hi Shaun,
I’ve released a new version of the plugin (2.1.8) which includes a fix that was submitted to us through Github. I believe that it’s the same issue that you’re running into, could you update and let me know if the error is resolved?
Many thanks!
Great! It is resolved. Closing