Support

Home Forums Event Espresso Premium Follow up question: EE4 doesn't work on WP Engine staging site without modifying

Follow up question: EE4 doesn't work on WP Engine staging site without modifying

Posted: August 1, 2017 at 3:41 pm


BCPTA

August 1, 2017 at 3:41 pm

Hi there, I’m just asking a follow up question to this thread: https://eventespresso.com/topic/ee4-core-activated-causes-error-on-wp-engine-staging-site/

Would the code mentioned there work in the functions.php file and not a site specific plugin? Just curious. Thanks.


Tony

  • Support Staff

August 2, 2017 at 3:36 am

Hi Johanna,

Possibly, but its bet to use a site specific plugin, we have a guide on how to create one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

However, can I ask why you are adding that code?
Are you getting an error on the site currently?


BCPTA

August 4, 2017 at 12:25 am

We always have a problem when we copy from live to staging. The issue never got resolved for us (noted earlier in the tickets). We have to deactivate all plugins, then reactivate one by one. Otherwise we get a 500 error. EE4 seems to be a culprit, especially when combined with the other plugins mentioned earlier.

I tried the code in functions.php but it didn’t work – caused some sort of error.

I guess I’ll try the plugin method.


Tony

  • Support Staff

August 4, 2017 at 3:12 am

Otherwise we get a 500 error.

A 500 error is basically ‘something went wrong’, it’s the public facing error shown when your site throws a fatal error.

So is the error your getting exactly the same as before?

Fatal error: Call to a member function get_page_permastruct() on a non-object in /nas/content/staging/bcpta/wp-includes/link-template.php on line 350

I tried the code in functions.php but it didn’t work – caused some sort of error.

Do you have the error?

That code isn’t causing any errors for me.


Tony

  • Support Staff

August 4, 2017 at 3:22 am

Also, what version number of EE are you using?

Your main site is using an .rc version which is multiple versions behind the latest release version.


BCPTA

August 8, 2017 at 9:53 pm

Currently Version 4.9.45.p on staging

We are updating every once in a while and recently updated on staging (testing first, this is why I’m writing here now). This has been ongoing, and apparently was supposed to be addressed earlier, but it never ever got fixed for us. Even when we update.

I was hoping for a longer-term solution.

The problem only happens on staging.


Tony

  • Support Staff

August 9, 2017 at 2:17 am

I think you missed my first reply above:

https://eventespresso.com/topic/follow-up-question-ee4-doesnt-work-on-wp-engine-staging-site-without-modifying/#post-248102

If you can answer those questions we can investigate this further.


Josh

  • Support Staff

August 9, 2017 at 8:44 pm

Would the code mentioned there work in the functions.php file and not a site specific plugin?

No, and the reason the code from the other topic will not work in a theme’s functions.php file is because by the time WordPress loads the theme it’s too late. Here’s the code snippet from the other topic:

add_action( 'plugins_loaded', 'my_remove_json_basic_auth_handler' );
function my_remove_json_basic_auth_handler() {
    remove_filter( 'determine_current_user', 'json_basic_auth_handler', 20 );
}

You’ll note the code gets fired on the plugins_loaded action hook, which happens early in the request before the theme files are loaded. You could try changing the hook from plugins_loaded to after_setup_theme which is the first action hook available to themes, triggered immediately after the active theme’s functions.php file is loaded. I haven’t tested the code to know whether it’d actually work using the other hook.

The support post ‘Follow up question: EE4 doesn't work on WP Engine staging site without modifying’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso