Google Analytics – checking for existance of W3TC functions before use
-
In plugin https://yoast.com/wordpress/google-analytics/, wouldn’t it be better code practice to check for the existance of each of the w3tc_ functions individually before calling them.
if ( function_exists(‘w3tc_pgcache_flush’) ) {
w3tc_pgcache_flush();
w3tc_dbcache_flush();
w3tc_minify_flush();
w3tc_objectcache_flush();
$cache = ‘ and W3TC Caches cleared‘;
} else if ( function_exists(‘wp_cache_clear_cache’) ) {
wp_cache_clear_cache();
$cache = ‘ and WP Super Cache cleared‘;
}
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Google Analytics – checking for existance of W3TC functions before use’ is closed to new replies.