PHP Warning
-
Hi Alin,
I have been getting a PHP Warning, I believe since the last plugin update:
call_user_func_array() expects parameter 1 to be a valid callback, class ‘GADWP_Tracking’ does not have a method ‘tracking_code’ in /public_html/wp-includes/class-wp-hook.php on line 298
As per this topic from over a year ago, I have the following code in a custom functions file:
add_action('init', 'ngadwp_move_trackingcode'); function ngadwp_move_trackingcode(){ if (class_exists('GADWP_Manager')){ $gadwp = GADWP(); if (isset($gadwp->tracking)){ remove_action('wp_head', array($gadwp->tracking,'tracking_code'), 99); $uri = $_SERVER["REQUEST_URI"]; $uri_array = split("/",$uri); $uri_first = $uri_array[1]; $uri_second = $uri_array[2]; // select the second split (domain does not count as split) if ( ($uri_first == 'subscriptions') && ( ($uri_second == 'manage') || ($uri_second == 'confirmation') || ($uri_second == 'unsubscribe') || ($uri_second == 'comments') ) ) { } else { add_action('wp_footer', array($gadwp->tracking,'tracking_code'), 0); } } } }
I imagine there’s now a conflict with the new settings to choose the positioning of the tracking code. I haven’t touched those, waiting to see if my code would continue to work. It does, as far as I can tell, but I’d like to figure out how to get rid of the error message flooding my error logs. I assume the above code is no longer needed to move the tracking code to the footer, as I can now use your built-in settings, so removing it would probably do the trick, but I still need to exclude the tracking code from certain pages. Is there a way to modify the above code to do just that?
Thanks for your help!
- The topic ‘PHP Warning’ is closed to new replies.