CalderaWP / Caldera-Forms

Drag and drop, responsive WordPress form builder.
https://CalderaForms.com
GNU General Public License v2.0
187 stars 163 forks source link

1.8.4 - Reference Error - wp is not defined #3141

Closed colbyalbo closed 5 years ago

colbyalbo commented 5 years ago

after updating to 1.8.4, the console logs this Reference error.

Reference Error - wp is not defined, and points to file " Caldera-forms/clients/render/build/index.min.js

No visible effect on the front end that i can tell

screenshots attached caldera1 caldera2

colbyalbo commented 5 years ago

upon further testing, it seems this is preventing the form from submitting. I'll post the JS console errors later

salihkulangara commented 5 years ago

While trying to fix this, I see when we load wp-embed scripts, the error goes and forms working back again. But it seems not ok, because most of the time to reduce the JS load size we are de-registering the wp-embed scripts, right?

New0 commented 5 years ago

Hello @colbyalbo , could you share the information asked in the template ?

Another user reported this issue and had it fixed by deactivating and reactivating plugins, #3144

@salihkulangara thank you for investigating this, we fixed a similar issue in previous version, what happened was that wp was not loaded if WordPress version was older than 5.0.0, we are now loading to prevent this issue. Loading wp-embed script probably enqueued wp, which solved the issue on your installation.

Also be sure to have all caches fully flushed to test that issue.

Shelob9 commented 5 years ago

Related https://github.com/wp-media/wp-rocket/issues/1561

3144

Shelob9 commented 5 years ago

In this helpscout ticket - https://secure.helpscout.net/conversation/830660038/20516/ We see this error. An optimization plugin of some sort is being used here. I will ask which one. 97% chance this is an issue with an "optimization"

Screen Shot 2019-04-19 at 9 04 07 AM

truloveliaison commented 5 years ago

I think this is related to my problem, as well: Seeking to try Caldera Forms-downloaded and activated....However, none of the buttons are working in admin. Thus, have no way to create a new form.... The only link that seems to work are those that target Caldera site page.....

toukira54 commented 5 years ago

i tried disabling the the WP-Rocket and other plugin but still facing the same issue. And I don't see any solution on this ticket. #3178 this is closed. What should be the ideal solution ?

Shelob9 commented 5 years ago

@toukira54 It would be helpful us find causes of this issue, providing a URL to the affected form and the debug information from the Caldera Forms support menu would be awesome for us.

If you need help right away, please contact technical support https://calderaforms.com/support

colbyalbo commented 5 years ago

Sorry for the delay. Here is the info from a local install of a replicated site. and screenshot of JS console errors

Short Debug Information WordPress Version: 5.1.1PHP Version: 7.2.10MySQL Version: 5.7.24Caldera Forms Version: 1.8.4WP_DEBUG:

Full Debug Information WordPress Version: 5.1.1 PHP Version: 7.2.10 MySQL Version: 5.7.24 Server Software: Apache Your User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0 Session Save Path: C:\MAMP\bin\php\sessions\ Session Save Path Exists: Yes Session Save Path Writeable: Yes Session Max Lifetime: 1440 Opcode Cache: Apc: No Memcached: No Redis: No Object Cache: Apc: No Apcu: No Memcache: No Memcached: No Redis: No WPDB Prefix: wp_ WP Multisite Mode: No WP Memory Limit: 40M Currently Active Theme: GeneratePress Child: 0.1 Plugins: Advanced Custom Fields: 5.7.12 Active All-in-One WP Migration: 6.92 Active All In One SEO Pack: 2.12 Active Caldera Forms: 1.8.4 Active Classic Editor: 1.4 Active Custom Post Type UI: 1.6.1 Active Disable Comments: 1.9.0 Active Duplicate Post: 3.2.2 Active Elementor: 2.5.14 Active Elementor Pro: 2.5.6 Active GP Premium: 1.8.1 Active ManageWP - Worker: 4.7.7 Not Active SendGrid: 1.11.8 Active Ultimate Addons for Elementor: 1.11.0 Active Wordfence Security: 7.2.5 Not Active WP Rocket: 3.3.1.1 Active

caldera184-noWPload

salihkulangara commented 5 years ago

Here is the my catch, as I said earlier I believe there is some relation with wp-embed scripts, because 1# In none of my sites I am using WP Rocket plugin, in some sites without any cache plugins also I am getting this error. So after digging in to this I have enqueued wp-embed through my functions.php and the issue fixed.

2# In some of our other sites we are using W3TC, in some of these sites I could see the same error, so while playing around, I found these sites were combining and loading scripts manually using W3TC, So I have changed the order of loading the wp-embed script that was loading in footer, I changed it to load in header, so that issue also fixed.

in my previous thread I got reply like

@salihkulangara thank you for investigating this, we fixed a similar issue in previous version, what happened was that wp was not loaded if WordPress version was older than 5.0.0, we are now loading to prevent this issue. Loading wp-embed script probably enqueued wp, which solved the issue on your installation.

but it seems still the issue persisits. So WP Rocket users try these for a quick fix: please check if you are combining and minifying the scripts, then load the wp-embed scrips above caldera scripts, that may fix the issue. If no wp-embed scripts, then manually load them using wp_enqueue_scripts in header.

toukira54 commented 5 years ago

Hi @Shelob9 ,

Here is the full debug information and the error I am getting on homepage i.e. https://www.wonderwardrobes.com

Full Debug Information WordPress Version: 5.1.1

PHP Version: 7.3.1-1+0~20190113101844.25+jessie~1.gbp15aaa9

MySQL Version: 5.6.43

Server Software: Apache/2.4.10 (Debian)

Your User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36

Session Save Path: /var/lib/php/sessions

Session Save Path Exists: Yes

Session Save Path Writeable: Yes

Session Max Lifetime: 1440

Opcode Cache:

Apc: Yes Memcached: No Redis: No Object Cache:

Apc: Yes Apcu: Yes Memcache: No Memcached: Yes Redis: No WPDB Prefix: wp_

WP Multisite Mode: No

WP Memory Limit: 40M

Currently Active Theme: Flatsome Child: 3.0

Plugins:

Abandoned Cart Lite for WooCommerce: 5.3.4 Active Akismet Anti-Spam: 4.1.1 Active AMP: 1.1.1 Active Caldera Forms: 1.8.4 Active Enhanced E-commerce for Woocommerce store: 2.1.7 Active Facebook for WooCommerce: 1.9.11 Active Glue for Yoast SEO & AMP: 0.4.3 Active Instant Articles for WP: 4.2.0 Active Kadence WooCommerce Email Designer: 1.1.9 Active Mailchimp for WooCommerce: 2.1.15 Active Nextend Social Login: 3.0.20 Active Nextend Social Login Pro Addon: 3.0.20 Active Outbound Link Manager: 1.2 Active Paytm Payment Gateway: 1.0 Not Active Peter's Post Notes: 1.6.5 Active Product Feed PRO for WooCommerce: 5.4.7 Active Razorpay for WooCommerce: 2.0.1 Active Really Simple SSL: 3.1.5 Active Schema: 1.7.5 Active SMSAlert - WooCommerce: 2.9.23 Active TeraWallet: 1.3.6 Active User Role Editor: 4.50.2 Active WC Cancel Order: 2.9 Active WooCommerce: 3.6.2 Active WooCommerce PDF Invoices & Packing Slips: 2.2.12 Active WooCommerce Services: 1.19.0 Active WooSidebars: 1.4.5 Active Wordfence Security: 7.2.5 Active WP Mail SMTP: 1.4.2 Active WP Rocket: 3.3.1.1 Active Yoast SEO Premium: 11.0 Active

New0 commented 5 years ago

Thank you @colbyalbo and @toukira54 for the details. To make sure there is no need to deactivate WP Rocket, could you confirm that the issue is fixed when you turn off the "disable embeds" option in WP Rocket ? ( make sure the cache is flushed to test again and page reloaded using ctrl + F5 )

Hello @salihkulangara and thank you for this useful information, in scenario 1 when no optimization plugin is used, did you identify why wp-embed was dequeued ?

toukira54 commented 5 years ago

@New0 Hi, the error is not available when we turn of turn off "disable embeds" but then it start giving error for some other plugin.

colbyalbo commented 5 years ago

@New0 Confirmed. Once the "disabled embeds" options is unchecked, the issue is fixed and the form submits properly

thanks

shaneonabike commented 5 years ago

I can confirm that ensuring the wp-embed is added works. This should certaintly be documented somewhere as I had removed it to optimize a website and looooooong forgot that it was gone. It was only this bug report that helped me determine the issue. Furthermore, this only just started not working so I don't fully understand unless you folks have changed the way that you are injecting forms now?

jonbhanson commented 5 years ago

I also had to enqueued wp-embed to fix the 'wp is not defined' error.

New0 commented 5 years ago

Closed via https://github.com/CalderaWP/Caldera-Forms/commit/08435530ac61f4dabbb8264fa6e43491f0bcc653

Shelob9 commented 5 years ago

I added docs related to why this happens, the new notice and how to fix it here: https://calderaforms.com/doc/caldera-forms-and-the-wp-variable/

I opened an issue to fix the root cause in WordPress here: https://core.trac.wordpress.org/ticket/47419#ticket

maxleistner commented 5 years ago

I got the same error, but i am not using any compression or caching plugins like WP Rocket. PHP 7.2 WP 5.2.1 Caldera Forms 1.8.5

Any ideas?

Bildschirmfoto 2019-06-14 um 17 09 44

@Shelob9

maxleistner commented 5 years ago

I found out, that if i include the file /wp-includes/wp-embed.min.js the forms do work again. But why should i add the script myself? Where can i decide if the js should be included or not?

Shelob9 commented 5 years ago

Most likely this is happening beacuse you disabled emojis. In 1.8.6 there is a more clear warning.

https://calderaforms.com/updates/caldera-forms-1-8-5/

On Mon, Jun 17, 2019, 11:05 AM Maximilian Leistner notifications@github.com wrote:

I found out, that if i include the file /wp-includes/wp-embed.min.js the forms do work again. But why should i add the script myself? Where can i decide if the js should be included or not?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CalderaWP/Caldera-Forms/issues/3141?email_source=notifications&email_token=AAPG4RZZUN2X2QHEWTWMQFLP26RZ7A5CNFSM4HDLB5W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX3O4SQ#issuecomment-502722122, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPG4R2I3G7AXCVL6UAXBTDP26RZ7ANCNFSM4HDLB5WQ .

maxleistner commented 5 years ago

Most likely this is happening beacuse you disabled emojis. In 1.8.6 there is a more clear warning. https://calderaforms.com/updates/caldera-forms-1-8-5/

How can i disable/enable emojis?

shaneonabike commented 5 years ago

Within the settings of WP Rocket you can improve performance by disabling emojicons. There's a switch there that you should check out.

jevgenijmokrousov commented 4 years ago

In my case it was wp_deregister_script('wp-embed'); in parent theme, which couldn't be changed so I've added in child theme wp_enqueue_script('wp-embed-calderaform', includes_url('js/wp-embed.js'), array());

saurabh172 commented 3 years ago

I am also facing this issue.

If I try with metabox in my custom post then its Ok. but In case of admin menu page of my custom plugin then Wordpress media library is not being opened. Even I have not used WP Rocket plugin as well as optimize plugin. I have Yoast SEO but I have already disabled it. Please reply.

image

colbyalbo commented 3 years ago

The plugin is abandoned i think. It always had problems anyway. Consider ninja forms