• Resolved fergieferg

    (@fergieferg)


    Hey Phi,

    I have a custom post type with custom fields (all built with metabox.io). When I try to use your plugin in the Query Loop for the custom post type, I get an error that “This block has encountered an error and cannot be previewed.”

    Is there something I need to do to get the plugin to work with Custom Post types?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Phi Phan

    (@mr2p)

    Hey @fergieferg, Could you please send me more info about the issue like the browser’s console error message?

    Thanks, Phi.

    Thread Starter fergieferg

    (@fergieferg)

    Hey Phi,

    Thanks for your reply. Please see the console error and the error in the block here:

    View post on imgur.com

    Plugin Author Phi Phan

    (@mr2p)

    Hey @fergieferg,

    There is not much I can do with the error message. However, the root problem may be that your meta field ‘company_name’ can’t be accessed via the rest API. You can double-check that by seeing the list of suggestion values after you choose field type as ‘Default meta’. If your field ‘company_name’ is not there, please turn on the setting to show it in the rest API. I don’t have much experience with metabox.io so you can ask them for help.
    Anyway, I’ll add a null check in the next version. But it won’t fix your issue.
    If you have more info about the issue, feel free to discuss it with me.

    Thanks, Phi.

    Thread Starter fergieferg

    (@fergieferg)

    Hey Phi,

    Thanks for the insights. I believe the settings are show in rest by default, but I will check with them as well.

    View post on imgur.com

    In this screenshot are there supposed to be suggested values for “Field name”? I don’t see any and when I start typing here this is when the error is triggered.

    Thanks,
    Fergal

    Plugin Author Phi Phan

    (@mr2p)

    Hey @fergieferg,
    Please download the latest version and test it.
    If you are using the block in the template editor, It won’t show the suggested values, because it requires postType and postId to get the metadata. Otherwise, it will show all available fields in other contexts.

    Thanks, Phi.

    Thread Starter fergieferg

    (@fergieferg)

    Hey Phi,

    I tested your newest version and the error went away. I still can’t get it to work for my use case, but thanks for adding the null check.

    Regards,
    Fergal

    Plugin Author Phi Phan

    (@mr2p)

    Hey Fergal,

    You’re welcome. Could you please send me the live URL of your site? I don’t need an account, I just want to check the JSON API to make sure your’s field is public or not. If your field is exposed to JSON API, It’ll probably work with this block.

    Phi.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘“This block has encountered an error and cannot be previewed.”’ is closed to new replies.