By default WordPress Creation Kit saves the Custom Fields in a Serialized Array.
To store each Custom Field in it’s own meta entry, you can use the following filter:
1 | apply_filters( 'wck_cfc_unserialize_fields_'.$your_meta_name, false ); |
You can add it in a plugin or your theme’s functions.php file by using the code below:
1 2 3 4 | add_filter( 'wck_cfc_unserialize_fields_your_meta_name', 'wck_change_unserialize_arg' ); function wck_change_unserialize_arg( $bool ){ return true; } |
When used like this it enables for that Custom Meta Box the unserialized_fields option. When enabled, besides the Serialized Array that is normally saved, each individual field will be saved in it’s own meta, regardless if it’s a Repeater Custom Meta Box or Single Custom Meta Box.
The meta key will have this form:
1 | $meta_name_arg . '_' . $field_slug .'_'. $n |
* Where $n starts at 1 and represents the number of the entry in the Repeater Custom Meta Box. For a Single Custom Meta Box it will be 1.
You can download and install this plugin to achieve this without writing code.
WCK Unserialized Fields plugin
You’ll get access to a new Meta Box in your Custom Meta Box called “Enable Unserialized Fields”.
If you enabled this feature AFTER adding content in your Custom Post Type and Meta Boxes, please re-save it (Edit -> Save Changes) on EACH individual Meta Box where you have Unserialized Fields enabled.
Combine the power of Profile Builder with Paid Member Subscriptions to set up user
Get 25% off with the bundle