CMb2_init action hook doesn't seem to work when using helper functions
-
Hello,
I’ve been trying to use the cmb2_init action hook for the cmb2_get_field_value() helper function based on the documentation. However this did not work as I kept getting an empty string. The documentation has this:function cmb2_init_check_field_value() { $radio_value = cmb2_get_field_value( 'test_metabox', '_cmb2_test_radio', get_queried_object_id() ); // Perform additional logic based on $radio_value } add_action( 'cmb2_init', 'cmb2_init_check_field_value' );
After trying several times I ended up accidentally making a typo that actually worked:
add_action('cmb2_ini','my_function' );
Also using
add_action('cmb_ini', 'my_function')
also works.Since it is working, Is it okay to continue using those hooks or will it break at some point in the future?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘CMb2_init action hook doesn't seem to work when using helper functions’ is closed to new replies.