WordPress.org

Ready to get started?Download WordPress

Forums

Google Analytics for WordPress
Fatal error: Call to a member function set_defaults() on a (4 posts)

  1. subnero2001
    Member
    Posted 2 years ago #

    Hi,

    I am getting this error repeatedly on different sites that I am running the Google Analytics Plugin on.

    What happens is:

    I login as Admin and get the message at the top that I need to link the Google Analytics Plugin to a Google Analytics account although I have done this multiple times.

    I click to do this and then this message comes up:

    Fatal error: Call to a member function set_defaults() on a non-object in /home/buyrarei/public_html/swissmetalassets.com/wp-content/plugins/google-analytics-for-wordpress/googleanalytics.php on line 1517

    Entire site including admin then goes offline for 5 - 10 minutes and displays the same message no matter what page you try to access.

    Something seems to reset itself after 5 - 10 minutes and then I can login again as Admin and link the Plugin to my Google Analytics account and it seems to work again for a while.

    On some of my sites this only happens occasionally and on others it has happened up to 20 times in one day while I am trying to add new posts or do something on the site.

    Any suggestions?

    Thanks,

    Mike

    http://wordpress.org/extend/plugins/google-analytics-for-wordpress/

  2. Zack Katz
    Member
    Posted 1 year ago #

    I had this same issue.

    Around line 1515 on googleanalytics.php, change:
    if (!is_array($options)) {

    To:
    if (!is_array($options) && class_exists('GA_Admin')) {

  3. Ryan
    Member
    Posted 1 year ago #

    Thanks for the tip for where to look. For whatever reason, that didn't work. But I did something similar and changed

    $ga_admin->set_defaults();

    to

    if ($ga_admin) $ga_admin->set_defaults();

    and it appears to be working correctly.

    One thought though. Does this only happen when the plugin is network activated? I didn't try it before the fix, but after I turned off network activate and left it to be manually activated on each site so I can leave it off if needed.

  4. mgrmn
    Member
    Posted 1 year ago #

    That will resolve the error, but can not activate tracking in admin panel

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic