I am working on a site that suddenly has these error messages:
[25-Aug-2022 16:23:38 UTC] PHP Notice: Undefined variable: post in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:38 UTC] PHP Notice: Undefined property: ElementorCoreKitsDocumentsKit::$ in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:38 UTC] PHP Notice: Trying to access array offset on value of type null in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
[25-Aug-2022 16:23:50 UTC] PHP Notice: Trying to get property 'ID' of non-object in /public_html/wp-content/plugins/elementor/core/base/document.php on line 250
The errors showed up whenever a customer tried to put a variable product into the shopping cart. On the front end it says:
This doesn’t happen if the customer adds a non-variable product to the cart, so I am not sure what is happening or how to repair this. I have reached out to elementor with no response at this point after 24 hours.
The code referenced in the error log is:
public function get_main_id() {
if ( ! $this->main_id ) {
$post_id = $this->post->ID;
$parent_post_id = wp_is_post_revision( $post_id );
if ( $parent_post_id ) {
$post_id = $parent_post_id;
}
$this->main_id = $post_id;
}
return $this->main_id;
}
This occurred after the site was moved to a new hosting company, however, the site was working fine for the past three weeks, and the issue wasn’t present.
3
Answers
I was able to figure out (With the help of Elementor Tier 2 support) that the hosting provider (Site Grounds) installs a plugin called "SiteGround Optimizer" that was causing this issue. There is a conflict between this plugin and Elementor in case anyone is having this issue.
EDITED: SiteGround was able to turn off the "Defer Render-blocking JavaScript" feature and the plugin worked with the rest of the site. If you are having a strange issue and you are on SiteGround, I highly recommend you turn this feature off to troubleshoot the issue better.
This is occurring on Kinsta too – so it’s not just the SG plugin. It could still be optimization related – but I can’t seem to find a resolution yet (even rolling back versions isn’t helping me).
that issue comes in new version of elementor, just rollback it previous version following this video https://youtu.be/3uwCRcQvIFw