Support » Plugin: Google Content Experiments » [Plugin: Google Content Experiments] Fatal error: Call to undefined function wp_get_theme()

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author glennm


    You need to upgrade your WordPress version.

    Please read the FAQ, where this question is answered.

    I don’t get the error message now, thank you.
    Google Experiments says “No Experiment Code Found”

    I have deactivated the caching plugin, waited 5 minutes after saving page with code, and tried with and without the:
    _udn = “”;

    I looked at the source code and there is a part that says:
    <!– Google Analytics tracking code not shown because users over level 8 are ignored –>

    Searching the internet doesn’t give any good reasons for what and why?
    Not sure if this matters or not.

    Here is the URL:

    Thanks for your help, I’m really glad you created this plugin!

    Plugin Author glennm



    <!– Google Analytics tracking code not shown because users over level 8 are ignored –>

    is part of the Google Analytics for WordPress by Yoast plugin. There is a setting to ignore administrators, therefore the tracking code is not shown.

    I see that you’re using the Thesis theme, which is not supported by default by the GCE plugin. Did you execute the additional steps which can be found on the Installation page?

    You need to insert <?php do_action( 'wpe_gce_head' ); ?> somewhere in the theme files. Without that code, the Experiment Code is not inserted, which explains why Google is not able to find it.

    Since I do not have access to Thesis theme files, I can’t tell you where exactly you should insert the code.

    I appreciate your help. I’ve been working with the THesis support and the best we can do so far is get the code before the </head> tag. (Not right after the <head>)

    Google Experiments gives this message when checking for the code:

    The experiment code was found after the Google Analytics tracking code:line:22, column:124, line:90, column:1.

    Will this be an issue?

    Thank you for helping!

    Plugin Author glennm


    Hi Prok444,

    By default, WordPress is lacking an action hook to execute code right after <head>. That´s why you need to insert the action hook in the theme files.

    Some themes do provide an action hook right after <head>, which makes it easy for the GCE plugin to hook into those hooks. Supported themes that hook into an existing action hook are listed on the Installation page.

    According to official Google documentation:

    Issue: Your page has the Google Analytics tracking code before the experiment code. This can cause a problem with your experiment.

    Solution: Move the experiment code so it comes before the Google Analytics tracking code. In general, the experiment code should be right after the opening head tag.

    So: You might try to see if your experiment will work (although the experiment code is after the Analytics code), but I can’t guarantee that it will work.

    Unfortunately there’s nothing I can do, since this is a theme-related issue.

    Thank you for the quick response!
    I’m working with the Thesis team on their forum.

    Thank you for the great support!

    Hi Glenn,

    I think we finally figured out how to insert that code into the head.
    Now, I’m running into this error message:

    Tracking code missing the cookie domain name declared in experiment code:line:75, column:1, line:92, column:1.
    Your page customizes the cookie domain name in the Google Analytics tracking code. The same customization should be present in the experiment code

    I added this to the beginning of the experiments code like mentioned in your FAQ:
    _udn = “”;

    This is the page I’m trying to get it to work:

    I have the google analytics plugin installed, but didn’t see anything that “jumped” out at me to cause this issue.

    Do you know what else could be causing it?
    Here is the experiments code I have pasted in your plugin section on that page:

    _udn = "";
    <!-- Google Analytics Content Experiment code -->
    <script>function utmx_section(){}function utmx(){}(function(){var
    function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.
    indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c.
    length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write(
    '<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl':
    '&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date().
    '" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();
    <!-- End of Google Analytics Content Experiment code -->

    Thanks for your help!

    Plugin Author glennm


    Dear Jeremy,

    You don’t need to insert the extra code, only the Google Content Experiment code. You’re now declaring an extra cookie domain, which is not present in the Google Analytics tracking code.


    _udn = "";

    from the Google Content Experiments code field and only insert the code between
    <!-- Google Analytics Content Experiment code -->
    <!-- End of Google Analytics Content Experiment code -->

    By the way: at this moment your code is still showing up before the </head> tag instead of right after the <head> tag, which might be causing issues with Google.
    Please let me know if you’ve found a solution for this with the Thesis support team.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Google Content Experiments] Fatal error: Call to undefined function wp_get_theme()’ is closed to new replies.