0

It's come to my attention that the original question was a little unclear.

I'm working on a custom-built YouTube plugin for WordPress which has passed all the tests on my local installation, but as soon as I try to run it on a live site, I start seeing fatal errors on the settings page:

enter image description here

The error occurs during a utility function I have to check whether or not the OAuth authentication is valid.

As shown in the screenshot, I fail when trying to call the Google_Client::getConfig() function, which is allegedly undefined.

This is unusual, because if this function was truly undefined, my test site would see the same errors, and (as pictured below), the function clearly exists: enter image description here

I did a var_dump() of get_class_methods() in both locations. On my test site, that produced 60 methods, one of which was the expected getConfig(). On the live site, however, I only had 48 methods, and getConfig() was not one of them.

It seems likely that there is some sort of versioning issue with the way I've included the Google API, but I haven't been able to zero in on it.

The live site site is clearly loading a different version of the Google_Client class, but I don't know where that could be coming from because the version I've included in the plugin definitely has the methods in question.

  • You might be informed that, third party plugin specific questions are off-topic here. I'm sure you've already read the faq. You should ask the question to the plugin support forum. – Mayeenul Islam Nov 10 '16 at 5:04
  • My mistake. I assumed referring to it as a custom plugin was enough to indicate that this is a plugin I am writing myself. It seem likely that there is an issue with the way I've loaded Google's PHP library within that plugin. As that's the only reason I can think of as to why it's not loading the class version in the included file. I'm looking for insight into general, plugin related core functions that might cause and/or influence this discrepancy. – Mike Nov 10 '16 at 5:23
  • Can you please show how you included the files? Did you use a package manager like Composer? Are those sub-repos in Git, Mercurial, …? – kaiser Nov 15 '16 at 20:42
0

After exhausting all other options, I uploaded the plugin to another site I manage, and it worked perfectly. Once I narrowed it down to an issue with a specific domain, I was able to identify the problem in the active theme.

The original theme I built for the site in question had some YouTube functionality baked in (major no-no), and that's proved to be the source of the conflict. Conveniently, that theme is being phased out, so this issue will resolve itself once the transition is complete.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.