Save Individual Options Instead of Single
-
I have a plugin I developed previously without using CMB2 and am in the process of converting it to use CMB2 for custom meta fields on post types, as well as the plugin options pages. However, I’m running into a situation with the later as a result of how the options were originally saved.
Previously I added the Option Page using the add_menu_page() method and added settings using the add_settings_section() methods. This has resulted in the plugin saving settings as individual rows in the wp_options table.
However, as I’m converting over to CMB2 it’s wanting to save each of my options in a single record in the wp_options table and serialize them in the option_value column. If I were just starting out developing my plugin I’d be fine with this, however, since the plugin is already built, I’m struggling with being able to maintain backward compatibility.
If all of the settings were only called from within the plugin, it wouldn’t be a big deal to convert them over when the plugin is updated, but unfortunately there are a handful of settings that get used directly inside of the theme.
Is it possible to get CMB2 to store each field as it’s own record in the wp_options table?
- The topic ‘Save Individual Options Instead of Single’ is closed to new replies.