• Resolved saxpaolo

    (@saxpaolo)


    Hello,
    I wonder if CMB2 custom registered metafields should be available or not in the wp.data “core/editor” Redux store in WordPress.

    I’ve got a bunch of CMB2 custom metafields in my theme, but if I call:

    wp.data.select(‘core/editor’).getEditedPostAttribute(‘meta’)

    …it return an empty array. While if I test an alternative metafield (created on the fly in my theme without CMB2 and using register_meta etc., this is available using wp.data.select

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi

    We don’t make use of register_meta as is, which will likely explain why the fields set up aren’t being available, while your quick test worked.

    We never used that because when CMB2 first started, register_meta wasn’t really an API that was publicly used/known about. It makes CMB2 very similar to a 3rd-party version of register_meta.

    That being said, longer term it would be worth seeing if CMB2 could also do register_meta and get some of this stuff out of the box, including default REST API support. However, not sure we would be able to promise any timeline for getting this done and well tested as part of an official release.

    Thread Starter saxpaolo

    (@saxpaolo)

    Hello Michael, thanks for your quick reply.
    understood – I think this could be a nice to have feature, since Gutenberg is here to stay (e.g. to get the CMB2 custom fields registered and available to be managed by components in a custom Gutenberg sidebar, so in order to follow as much as possible the WP ux guidelines).

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Definitely something worth considering longer term, but at the same time I could see reason to just stick with the metaboxes that already get registered by it, without taking anything to the sidebar as you mention.

    Just for my own education and curiosity sake, I am curious about what sort of examples or usecases could be made for taking meta content being created by CMB2 UI to the sidebar as well as the metabox created by its code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CMB2 meta fields and core/editor WP Redux store’ is closed to new replies.