• Resolved Jonathan Stegall

    (@jonathanstegall)


    I have several custom post types where I currently use cmb2_init to add fields. I’m considering switching them to cmb2_admin_init.

    We don’t run front end forms through CMB2, for whatever that’s worth. I’m not aware of any places where we use CMB2 methods to load the value, if that’s even possible? We use get_post_meta when we want to display a value, in any case.

    I’m not sure if I just didn’t realize that cmb2_admin_init existed, or if I hadn’t thought through the implications. But it does seem like my front end might get a performance boost by doing this? Are there any other considerations I need to take first?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Justin Sternberg

    (@jtsternberg)

    The only other caveat to using cmb2_admin_init is that boxes/fields designated for the REST API will not work.
    But cmb2_admin_init is the preferred hook UNLESS needing access to the CMB2 functionality on the frontend or REST API.

    Thread Starter Jonathan Stegall

    (@jonathanstegall)

    That sounds good, thank you. We do sometimes create or read meta fields via the REST API, but not using anything cmb2-specific.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Considering replacing cmb2_init with cmb2_admin_init in my theme’ is closed to new replies.