Support

Account

Home Forums Backend Issues (wp-admin) Uncaught TypeError: Cannot read property 'body' of undefined

Solved

Uncaught TypeError: Cannot read property 'body' of undefined

  • I upgraded to latest versions of ACF 4.4.8 and WordPress 4.6.

    There is a bug where the first custom field is fine, but TinyMCE intermittently dies for the second to x fields. It usually dies. Issue is confirmed on both Chrome and Firefox.

    The error is: Uncaught TypeError: Cannot read property ‘body’ of undefined

    Has anyone else had this issue?

  • +1

    I am also having this issue. The first WYSIWYG area displays correctly, but the the ones following after that do not display because of the JS error.

    Error: Uncaught TypeError: Cannot read property ‘body’ of undefined
    Line: wp-tinymce.php?c=1&ver=4401-20160726:12

    Stack Trace

    getBody @ wp-tinymce.php?c=1&ver=4401-20160726:12
    add_events @ input.min.js?ver=4.4.8:2
    init @ input.min.js?ver=4.4.8:2
    (anonymous function) @ input.min.js?ver=4.4.8:2
    each @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,wp-a11…:2
    each @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,wp-a11…:2
    (anonymous function) @ input.min.js?ver=4.4.8:2

  • +1

    Same problem here after update WordPress to 4.6

  • I just tested this on a site with only ACF and WP, I tested with both ACF4 and ACF5. I’m not getting this error. Have you tried deactivating plugins or changing themes?

    Are the WYSIWYG fields at the top level or are they in a repeater or something? What are the settings for the fields. If you give me some more information I’ll try more testing if I am able to. I don’t have the flex field for ACF 4 though so I can only go so far with that.

  • @hube2 I am honestly at a loss of what could have caused this, but interestingly the issue seems to have resolved itself…

    The only plugins that are installed are:

    – formidable pro
    – wp seo / yoast

    The theme is a custom one extended from roots/sage but doesn’t make any changes to the backend.

  • I am getting one JS error with ACF 4

    Error: Syntax error, unrecognized expression: #wp-wysiwyg-acf-field-wysiwyg_(copy)-57bf4a104c01f-wrap

    and this error is cause by the way I created the test group I used, but it doesn’t seem to be breaking anything.

  • Since this is for ACF 4, please submit an issue here https://github.com/elliotcondon/acf or by submitting a new ticket https://support.advancedcustomfields.com/new-ticket/. This will get to the developer faster. Over on GitHUb would likely be the best choice.

  • I’ve reported this to the developer on ACF5, like I said, if you’re seeing issues in 4, which have also been reported, the best place to report them is on the github repo for 4.

  • Hi guys

    Thanks for the bug reports

    I’ve spent some time debugging these tinymce issues and believe to have found a fix!
    If possible, can you please download and test the latest build of ACF PRO (5.4.3 RC1)?

    1. Login to your account online: http://www.advancedcustomfields.com/my-account
    2. Click on the ‘see all versions’ link next to your license
    3. Download the latest 5.4.3 RC1 version​​

    ​​Please let me know how you go. I’ll be able to release this as a public update when I hear back form a few other tickets

  • Might be staring at me but I don’t see the 5.4.3 RC1 version.

  • 5.4.3 is no longer RC and the update has been released, so the RC version is not longer available.

  • Of course! My mistake: I was thinking 5.4.3.1 or whatever comes next.

    Still getting ReferenceError: Can’t find variable: tinymce in acf-input.min.js:3:7916

  • Had to roll back to 5.4.2.

  • Hi @dbrabyn

    Thanks for the info.
    I’ve just uploaded a new RC for testing (5.4.4-RC1)

    Can you please login, download and test this out?
    Remember to hard refresh your browser to clear cached JS files when testing the issue

    Thanks
    Elliot

  • That seems to have worked.

    Thanks.

  • I am still having this issue. I don’t understand. What is the solution?

  • Hi @jordanr

    Thanks for the reply.

    Can you please provide login access to your site for me to test?
    I have a feeling this issue is due to cached JS conflicting with the new tinymce library in WP 4.6

    Thanks
    Elliot

  • I registered you. You should receive email.

  • Cached JS would make sense but I don’t see why after a month it doesn’t clear.

    Also the issue comes and goes. It works, then doesn’t, then works again.

  • Could it be that the body is being accessed before the editor is initialized? That would make sense…

  • When I remove the call of “this.add_events” from the input.min.js file, init function, the issue goes away.

  • Hi guys

    Thanks for all the comments.
    I’ve just had some luck replicating the issue and will most likely have a fix out today.

    Yes, the issue is triggered from the acf.fields.wysiwyg.add_events function

  • Hi guys

    Issue update:

    I’ve logged into a few users websites, but am unable to replicate the issue!
    – The WYSIWYG editors load just fine

    The only time I’ve been able to replicate the issue is when I screen-shared with another user to view his wp-admin. He was running windows and the wp-admin page took quite a while to load.

    I’m starting to think the issue may be due to the computer / browser load times.
    Maybe my mac is loading the page too quickly and the issue never triggers.

    Can you please be sure to note your details:
    ACF version:
    WP version:
    OS:
    Browser inc version:

    Thanks
    Elliot

  • Hi @jordanr – just logged in but can’t replicate the issue!!?

Viewing 25 posts - 1 through 25 (of 31 total)

The topic ‘Uncaught TypeError: Cannot read property 'body' of undefined’ is closed to new replies.