Support » Plugin: Google Analytics for WordPress by MonsterInsights » Google Analytics – checking for existance of W3TC functions before use

  • In plugin http://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)
  • Joost de Valk

    (@joostdevalk)

    Why would that be an issue? If the first exists, W3TC is loaded and all should normally exist?

    Joost de Valk

    (@joostdevalk)

    Anyway, I’ll check my code. Next time, try and be nice 🙂

    Aaron Brazell

    (@technosailor)

    No, Joost. That’s not how it works. W3TC is modular and you can load all or some of it.

    Yes the function_exists() verifes that the plugin is active, but the pgcache, dbcache, minify and objectcache stuff can all be turned on or off selectively.

    Joost de Valk

    (@joostdevalk)

    I’ll fix, next time, please drop me an email if you’re having issues on your setup.

    Aaron Brazell

    (@technosailor)

    That’s what a support forum is for. 😛

    Joost de Valk

    (@joostdevalk)

    Well, not if you have a relationship were you could have just emailed me.

    Aaron Brazell

    (@technosailor)

    “Well, yes, until you go out and tell people my stuff doesn’t work before getting a reply.”

    I have no idea what you’re on about. Really very confused. As far as I know, Mark posted that one post above… and that’s it until you responded today. So I’d highly recommend you actually email me before causing a scene. You have my contact info.

    Joost de Valk

    (@joostdevalk)

    just reached out on Skype. Let’s talk.

    markkelnar

    (@markkelnar)

    No harsh tone intended. Glad we were able to come together to resolve the issue.

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.