• Resolved janwass

    (@janwass)


    Hi,

    when I try to use ngg 3.1.6 in a WP 5.1 install the ngg-post-thumbnail.min.js crashes on custom post types admin edit with gutenberg enabled.

    Browser console log:
    TypeError: Cannot read property ‘ngg_post_thumbnail’ of undefined
    at ngg-post-thumbnail.min.js:141
    […]

    This is because wp.data.select(“core/editor”).getEditedPostAttribute(“meta”) returns ‘undefined’ on custom post types.

    This has been tested with my own custom post type as well as with CPT UI custom post types (to make sure the error wasn’t on my end).

    I also already tried to add register_meta ‘ngg_post_thumbnail’ for my custom post type, but that didn’t help. Afaik this shouldn’t be necessary anyway.

    I would be happy if someone could provide a quick fix for this issue.

    Thank you!
    Jan

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @janwass

    We want to take a closer look at this error you are experiencing. We may need to deactivate plugins and switch the theme while troubleshooting temporarily. Would you feel OK with that? If so, please send us a bug report here: https://www.imagely.com/report-bug, refer back to this forum thread and let them know Gaby referred you.

    Thanks!

    – Gaby, Customer Support.

    Thread Starter janwass

    (@janwass)

    Hi again,

    if anyone else stumbles over this behaviour:
    You have to set ‘custom-fields’ in the ‘supports’ array of your custom post type for meta that has been registered via ‘register_meta’ to work with REST API.
    https://github.com/WordPress/gutenberg/issues/5622

    While I figured out the solution by myself in the end: thumbs up for NGG support and bugtracker staff answering quickly and very politely!

    I’ll consider recommending our customers getting a PRO license for NGG after this good experience.

    Have a nice day!
    Jan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘JS error with custom post type and gutenberg activated’ is closed to new replies.